Version: 9.16.0
SMESHUtils::BoostTxtArchive Class Reference

Load an object from a string created by boost::archive::text_oarchive. More...

#include <SMESH_BoostTxtArchive.hxx>

Public Member Functions

 BoostTxtArchive (const std::string &s)
 
 BoostTxtArchive (std::istream &stream)
 
 ~BoostTxtArchive ()
 
template<class T >
BoostTxtArchiveoperator>> (T &t)
 

Private Member Functions

void makeReader ()
 
bool fixString ()
 Change boost::archive library version in myString to be equal to the current library version. More...
 
template<class Archive >
void serialize (Archive &, const unsigned int)
 

Private Attributes

boost::archive::text_iarchive * myArchiveReader
 
std::string myString
 
bool myStringFixed
 
std::istream * myStream
 
bool myOwnStream
 

Friends

class boost::serialization::access
 

Detailed Description

Load an object from a string created by boost::archive::text_oarchive.

Try to workaround the issue that loading fails if the archive string is created by a newer version of boost::archive library.

Usage: ObjType obj; SMESHUtils::BoostTxtArchive( arcString ) >> obj;

Constructor & Destructor Documentation

◆ BoostTxtArchive() [1/2]

BoostTxtArchive::BoostTxtArchive ( const std::string &  s)

References makeReader(), myStream, and myString.

◆ BoostTxtArchive() [2/2]

BoostTxtArchive::BoostTxtArchive ( std::istream &  stream)

References makeReader(), and myString.

◆ ~BoostTxtArchive()

BoostTxtArchive::~BoostTxtArchive ( )

Member Function Documentation

◆ fixString()

bool BoostTxtArchive::fixString ( )
private

Change boost::archive library version in myString to be equal to the current library version.

Returns
bool - return true if the version is changed

References myOwnStream, myStream, myString, and myStringFixed.

Referenced by makeReader().

◆ makeReader()

void BoostTxtArchive::makeReader ( )
private

References fixString(), myArchiveReader, and myStream.

Referenced by BoostTxtArchive().

◆ operator>>()

template<class T >
BoostTxtArchive & SMESHUtils::BoostTxtArchive::operator>> ( T &  t)

◆ serialize()

template<class Archive >
void SMESHUtils::BoostTxtArchive::serialize ( Archive &  ,
const unsigned int   
)
private

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Field Documentation

◆ myArchiveReader

boost::archive::text_iarchive* SMESHUtils::BoostTxtArchive::myArchiveReader
private

Referenced by makeReader(), and ~BoostTxtArchive().

◆ myOwnStream

bool SMESHUtils::BoostTxtArchive::myOwnStream
private

Referenced by fixString(), and ~BoostTxtArchive().

◆ myStream

std::istream* SMESHUtils::BoostTxtArchive::myStream
private

◆ myString

std::string SMESHUtils::BoostTxtArchive::myString
private

Referenced by BoostTxtArchive(), and fixString().

◆ myStringFixed

bool SMESHUtils::BoostTxtArchive::myStringFixed
private

Referenced by fixString().