Go to the documentation of this file.
30 #ifndef _GENICAM_PERSISTENCE_H
31 #define _GENICAM_PERSISTENCE_H
73 bool LoadFromBag(
INodeMap *pNodeMap,
bool Verify =
true, GENICAM_NAMESPACE::gcstring_vector *pErrorList = NULL);
81 int64_t StoreToBag(
INodeMap *pNodeMap,
const int MaxNumPersistSkriptEntries = -1, GENICAM_NAMESPACE::gcstring_vector *pFeatureFilter = NULL);
110 void Push(
const char *name,
const char *value,
CSelectorState *ps);
133 const Triplet * operator -> (
void)
const;
153 struct FeatureBagImpl;
157 bool LoadFromBagInternal(
INodeMap *pNodeMap,
bool Verify , GENICAM_NAMESPACE::gcstring_vector *pErrorList = NULL);
158 int64_t StoreToBagInternal(
INodeMap *pNodeMap,
const int MaxNumPersistSkriptEntries = -1, GENICAM_NAMESPACE::gcstring_vector *pFeatureFilter = NULL);
164 #define GENAPI_PERSISTENCE_MAGIC "{05D8C294-F295-4dfb-9D01-096BD04049F4}"
167 #define GENAPI_PERSISTENCE_MAGIC_FEATUREBAGGER "{4709CB3C-7322-4460-84C3-DA11DDA09939}"
178 char FirstCharacter =
static_cast<char>(is.peek());
179 while( FirstCharacter ==
'#' )
181 is.ignore(1024,
'\n');
182 FirstCharacter =
static_cast<char>(is.peek());
187 #ifndef GENAPI_DONT_USE_DEFAULT_PERSISTENCE_FILE_FORMAT
188 inline char*
TrimSpace(
char* Name, std::istream& is )
191 char* pend = Name + strlen( Name );
193 for (; pc < pend && std::isspace( *pc, is.getloc() ); ++pc);
194 for (--pend; pc < pend && std::isspace( *pend, is.getloc() ); --pend);
203 for (; ibegin < iend && std::isspace( s[ibegin], is.getloc() ); ++ibegin);
204 for (--iend; ibegin < iend; --iend)
206 if (!std::isspace( s[iend], is.getloc() ))
213 s.
erase( 0, ibegin );
239 throw RUNTIME_EXCEPTION(
"The stream is not a GenApi feature stream since it is missing the magic GUID in the first line");
241 throw RUNTIME_EXCEPTION(
"The stream has been created using the CFeatureBagger class thus must be restored using the CFeatureBagger class as well");
271 if (is.peek() ==
'{')
281 const size_t ibeg = (Value[0] ==
'{') ? 1 : 0;
283 const size_t lhs_len = iassign - ibeg;
286 pSelectorState->
AddSelector( selectorName, selectorValue );
321 os <<
"# " << FeatureBag.
GetInfo() <<
"\n";
331 if ((it->pState)->IsEmpty())
333 os << Name <<
"\t" << Value <<
"\n";
339 (it->pState)->SetFirst();
346 os << (it->pState)->GetNodeName() <<
"=" << (it->pState)->GetNodeValue();
347 }
while ((it->pState)->SetNext());
348 os <<
"}\t" << Value <<
"\n";
354 #endif // #ifndef GENAPI_DONT_USE_DEFAULT_PERSISTENCE_FILE_FORMAT
396 size_t Bag(
INodeMap *pNodeMap,
bool handleDefaultNodeMap =
true,
bool handleUserSets =
false,
bool handleSequencerSets =
false,
const int MaxNumPersistSkriptEntries = -1);
405 bool UnBag(
INodeMap *pNodeMap,
bool Verify =
true, GENICAM_NAMESPACE::gcstring_vector *pErrorList = NULL);
414 virtual const CFeatureBag& at(
size_t uiIndex)
const;
415 virtual size_t size(
void)
const;
427 void DeleteAllBags(
void );
436 #ifndef GENAPI_DONT_USE_DEFAULT_PERSISTENCE_FILE_FORMAT
446 os <<
"# " << featureBagger.
m_Info <<
"\n";
450 for (it = featureBagger.
begin(); it != featureBagger.
end(); it++)
452 os <<
"[" << (*it).GetBagName() <<
"]\n";
473 bool boCFeatureBagFormatDetected =
false;
479 throw RUNTIME_EXCEPTION(
"The stream is not a GenApi feature stream since it is missing the magic GUID in the first line");
481 boCFeatureBagFormatDetected =
true;
484 std::stringstream currentBagData;
485 if (boCFeatureBagFormatDetected)
487 currentBagData << FirstLine;
496 CFeatureBag *pBag = boCFeatureBagFormatDetected ? &featureBagger.
AddBag(
"All") : NULL;
506 if (!line.
empty() && (line[0] ==
'['))
508 if (!currentBagData.str().empty())
512 currentBagData >> (*pBag);
514 currentBagData.str(
"");
515 currentBagData.clear();
521 if( !bagName.
empty() )
523 pBag = &featureBagger.
AddBag(bagName);
528 currentBagData << line <<
"\n";
531 if (!currentBagData.str().empty() && pBag)
533 currentBagData >> (*pBag);
537 #endif // #ifndef GENAPI_DONT_USE_DEFAULT_PERSISTENCE_FILE_FORMAT
540 #endif //_GENICAM_PERSISTENCE_H
virtual GENICAM_NAMESPACE::gcstring ToString()=0
Returns a string representation of the digit.
Lexical analyzer for CIntSwissKnife.
Definition of template CPointer.
The set of selectors selecting a given node.
#define GENAPI_PERSISTENCE_MAGIC
the magic GUID which indicates that the file or buffer is a GenApi stream created by the CFeatureBag ...
Common types used in the public GenApi interface.
virtual gcstring substr(size_t offset=0, size_t count=GCSTRING_NPOS) const
virtual bool empty(void) const
#define GENICAM_INTERFACE
A string class which is a clone of std::string.
virtual void PersistFeature(IValue &item, CSelectorSet *selectorSet=NULL)=0
Stores a feature.
const GENICAM_NAMESPACE::gcstring & GetInfo() const
virtual size_t find_last_of(const gcstring &str, size_t offset=GCSTRING_NPOS) const
#define GENAPI_VERSION_MAJOR
#define GENAPI_PERSISTENCE_MAGIC_FEATUREBAGGER
the magic GUID which indicates that the file is a GenApi stream file created by the CFeatureBagger cl...
std::ostream & operator<<(std::ostream &os, const CFeatureBag &FeatureBag)
writes out persistent data to a stream
virtual void reserve(size_t n=0)
CSelectorState * AllocateSelector()
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT bool Verify
virtual const_iterator begin(void) const
virtual GENICAM_NAMESPACE::gcstring operator*()=0
Get string node value.
GENICAM_NAMESPACE::gcstring name
GENICAM_INTERFACE INodeMap
Interface to access the node map.
#define GENAPI_VERSION_SUBMINOR
void Push(const char *name, const char *value, CSelectorState *ps)
std::istream & getline(std::istream &is, GENICAM_NAMESPACE::gcstring &str)
STL getline.
const_iterator GetBegin()
Bag holding streamable features of a nodetree.
virtual size_t length(void) const
bool operator==(const MyAlloc< T1 > &, const MyAlloc< T2 > &)
virtual gcstring & erase(size_t pos, size_t len=GCSTRING_NPOS)
std::istream & operator>>(std::istream &is, CFeatureBag &FeatureBag)
reads in persistent data from a stream
void Destroy(SerialPortMap &portList)
Encapsulates a GenApi pointer dealing with the dynamic_cast automatically.
Class use to bag features.
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IValue
Interface for value properties.
static size_t _npos(void)
void AddSelector(IValue &item)
Add a node the the selector state.
virtual size_t find_first_of(const gcstring &str, size_t offset=0) const
virtual const char * c_str(void) const
virtual size_t find(char ch, size_t offset=0) const
void DeleteSelector(CSelectorState *&p)
bool operator!=(const MyAlloc< T1 > &, const MyAlloc< T2 > &)
CFeatureBag & AddBag(const GENICAM_NAMESPACE::gcstring &bagName)
#define GENAPI_VERSION_MINOR
char * TrimSpace(char *Name, std::istream &is)
Helper function cutting off space characters.
#define RUNTIME_EXCEPTION
Fires a runtime exception, e.g. throw RUNTIME_EXCEPTION("buh!")
std::istream & EatComments(std::istream &is)
Helper function ignoring lines starting with comment character '#'.
virtual IBoolean & operator=(bool Value)
Set node value.
declspec's to be used for GenApi Windows dll
virtual const_iterator end(void) const
GENICAM_NAMESPACE::gcstring m_Info
String describing the node map.
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IPersistScript
Basic interface to persist values to.
GENICAM_NAMESPACE::gcstring value
rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Wed Dec 4 2024 03:10:11