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 824 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 829 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 831 of file DataIO.h.

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

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

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

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

848  {
849  return s.size() + size_bytes;
850  }

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

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

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

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

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


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