www.mooseframework.org
Public Types | Static Public Member Functions | Static Public Attributes | List of all members
libMesh::Parallel::Packing< std::basic_string< T > > Class Template Reference

#include <DataIO.h>

Public Types

typedef T buffer_type
 

Static Public Member Functions

static unsigned int get_string_len (typename std::vector< T >::const_iterator in)
 
static unsigned int packed_size (typename std::vector< T >::const_iterator in)
 
static unsigned int packable_size (const std::basic_string< T > &s, const void *)
 
template<typename Iter >
static void pack (const std::basic_string< T > &b, Iter data_out, const void *)
 
static std::basic_string< T > unpack (typename std::vector< T >::const_iterator in, void *)
 

Static Public Attributes

static const unsigned int size_bytes = 4
 

Detailed Description

template<typename T>
class libMesh::Parallel::Packing< std::basic_string< T > >

Definition at line 837 of file DataIO.h.

Member Typedef Documentation

◆ buffer_type

template<typename T >
typedef T libMesh::Parallel::Packing< std::basic_string< T > >::buffer_type

Definition at line 842 of file DataIO.h.

Member Function Documentation

◆ get_string_len()

template<typename T >
static unsigned int libMesh::Parallel::Packing< std::basic_string< T > >::get_string_len ( typename std::vector< T >::const_iterator  in)
inlinestatic

Definition at line 844 of file DataIO.h.

845  {
846  unsigned int string_len = reinterpret_cast<const unsigned char &>(in[size_bytes - 1]);
847  for (signed int i = size_bytes - 2; i >= 0; --i)
848  {
849  string_len *= 256;
850  string_len += reinterpret_cast<const unsigned char &>(in[i]);
851  }
852  return string_len;
853  }

◆ pack()

template<typename T >
template<typename Iter >
static void libMesh::Parallel::Packing< std::basic_string< T > >::pack ( const std::basic_string< T > &  b,
Iter  data_out,
const void *   
)
inlinestatic

Definition at line 866 of file DataIO.h.

867  {
868  unsigned int string_len = b.size();
869  for (unsigned int i = 0; i != size_bytes; ++i)
870  {
871  *data_out++ = (string_len % 256);
872  string_len /= 256;
873  }
874 
875  std::copy(b.begin(), b.end(), data_out);
876  }

◆ packable_size()

template<typename T >
static unsigned int libMesh::Parallel::Packing< std::basic_string< T > >::packable_size ( const std::basic_string< T > &  s,
const void *   
)
inlinestatic

Definition at line 860 of file DataIO.h.

861  {
862  return s.size() + size_bytes;
863  }

◆ packed_size()

template<typename T >
static unsigned int libMesh::Parallel::Packing< std::basic_string< T > >::packed_size ( typename std::vector< T >::const_iterator  in)
inlinestatic

Definition at line 855 of file DataIO.h.

856  {
857  return get_string_len(in) + size_bytes;
858  }
static unsigned int get_string_len(typename std::vector< T >::const_iterator in)
Definition: DataIO.h:844

◆ unpack()

template<typename T >
static std::basic_string<T> libMesh::Parallel::Packing< std::basic_string< T > >::unpack ( typename std::vector< T >::const_iterator  in,
void *   
)
inlinestatic

Definition at line 878 of file DataIO.h.

879  {
880  unsigned int string_len = get_string_len(in);
881 
882  std::ostringstream oss;
883  for (unsigned int i = 0; i < string_len; ++i)
884  oss << reinterpret_cast<const unsigned char &>(in[i + size_bytes]);
885 
886  in += size_bytes + string_len;
887 
888  return oss.str();
889  }
static unsigned int get_string_len(typename std::vector< T >::const_iterator in)
Definition: DataIO.h:844

Member Data Documentation

◆ size_bytes

template<typename T >
const unsigned int libMesh::Parallel::Packing< std::basic_string< T > >::size_bytes = 4
static

Definition at line 840 of file DataIO.h.


The documentation for this class was generated from the following file: