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 822 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 827 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 829 of file DataIO.h.

830  {
831  unsigned int string_len = reinterpret_cast<const unsigned char &>(in[size_bytes - 1]);
832  for (signed int i = size_bytes - 2; i >= 0; --i)
833  {
834  string_len *= 256;
835  string_len += reinterpret_cast<const unsigned char &>(in[i]);
836  }
837  return string_len;
838  }

◆ 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 851 of file DataIO.h.

852  {
853  unsigned int string_len = b.size();
854  for (unsigned int i = 0; i != size_bytes; ++i)
855  {
856  *data_out++ = (string_len % 256);
857  string_len /= 256;
858  }
859 
860  std::copy(b.begin(), b.end(), data_out);
861  }

◆ 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 845 of file DataIO.h.

846  {
847  return s.size() + size_bytes;
848  }

◆ 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 840 of file DataIO.h.

841  {
842  return get_string_len(in) + size_bytes;
843  }
static unsigned int get_string_len(typename std::vector< T >::const_iterator in)
Definition: DataIO.h:829

◆ 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 863 of file DataIO.h.

864  {
865  unsigned int string_len = get_string_len(in);
866 
867  std::ostringstream oss;
868  for (unsigned int i = 0; i < string_len; ++i)
869  oss << reinterpret_cast<const unsigned char &>(in[i + size_bytes]);
870 
871  in += size_bytes + string_len;
872 
873  return oss.str();
874  }
static unsigned int get_string_len(typename std::vector< T >::const_iterator in)
Definition: DataIO.h:829

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 825 of file DataIO.h.


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