49 FD_DC(
"vBaseVector(" <<
this <<
")::vBaseVector()");
59 FD_DC(
"vBaseVector(" <<
this <<
")::vBaseVector()");
63 Read(rFileName,rLabel);
71 FD_DC(
"vBaseVector(" <<
this <<
")::vBaseVector(rOtherVector " << &rOtherVector <<
"): copy construct");
77 FD_DC(
"vBaseVector(" <<
this <<
")::~vBaseVector()");
82 FD_DC(
"vBaseVector(" <<
this <<
")::~vBaseVector(): done");
109 FD_DC(
"vBaseVector(" <<
this <<
")::DoAssign(rOtherVector " << &rSourceVector <<
")");
111 if(
this==&rSourceVector)
return;
118 mVector[pos].pElement = rSourceVector.
mVector[pos].pElement->Copy();
123 FD_DC(
"vBaseVector(" <<
this <<
")::DoAssign(rOtherVector " << &rSourceVector <<
"): done");
154 FD_DC(
"vBaseVector(" <<
this <<
")::Size(..): from " <<
mVector.size() <<
" to " << len);
158 for(
Position pos=len; pos<olen; pos++)
163 for(
Position pos=olen; pos < len; pos++) {
169 FD_DC(
"vBaseVector(" <<
this <<
")::Size(..): done");
181 #ifdef FAUDES_CHECKED
183 std::stringstream errstr;
184 errstr <<
"index out of range" << std::endl;
185 throw Exception(
"vBaseVector::At", errstr.str(), 62);
193 #ifdef FAUDES_CHECKED
195 std::stringstream errstr;
196 errstr <<
"index out of range" << std::endl;
197 throw Exception(
"vBaseVector::At", errstr.str(), 62);
207 #ifdef FAUDES_CHECKED
209 std::stringstream errstr;
210 errstr <<
"index out of range" << std::endl;
211 throw Exception(
"vBaseVector::At", errstr.str(), 62);
215 std::stringstream errstr;
216 errstr <<
"cannot cast element " << std::endl;
217 throw Exception(
"vBaseVector::Replace(pos,elem)", errstr.str(), 63);
220 if(pit->mMine)
delete pit->pElement;
221 pit->pElement=rElem.
Copy();
228 #ifdef FAUDES_CHECKED
230 std::stringstream errstr;
231 errstr <<
"index out of range" << std::endl;
232 throw Exception(
"vBaseVector::At", errstr.str(), 62);
236 std::stringstream errstr;
237 errstr <<
"cannot cast element " << std::endl;
238 throw Exception(
"vBaseVector::Replace(pos,elem)", errstr.str(), 63);
241 if(pit->mMine)
delete pit->pElement;
249 #ifdef FAUDES_CHECKED
251 std::stringstream errstr;
252 errstr <<
"index out of range" << std::endl;
253 throw Exception(
"vBaseVector::At", errstr.str(), 62);
257 if(pit->mMine)
delete pit->pElement;
260 pit->pElement->Read(rFileName);
261 pit->mFileName=rFileName;
266 #ifdef FAUDES_CHECKED
268 std::stringstream errstr;
269 errstr <<
"index out of range" << std::endl;
270 throw Exception(
"vBaseVector::At", errstr.str(), 62);
274 if(pit->mMine)
delete pit->pElement;
281 #ifdef FAUDES_CHECKED
283 std::stringstream errstr;
284 errstr <<
"index out of range" << std::endl;
285 throw Exception(
"vBaseVector::At", errstr.str(), 62);
289 std::stringstream errstr;
290 errstr <<
"cannot cast element " << std::endl;
291 throw Exception(
"vBaseVector::Insert(pos,elem)", errstr.str(), 63);
303 #ifdef FAUDES_CHECKED
305 std::stringstream errstr;
306 errstr <<
"index out of range" << std::endl;
307 throw Exception(
"vBaseVector::At", errstr.str(), 62);
311 std::stringstream errstr;
312 errstr <<
"cannot cast element " << std::endl;
313 throw Exception(
"vBaseVector::Insert(pos,elem)", errstr.str(), 63);
325 #ifdef FAUDES_CHECKED
327 std::stringstream errstr;
328 errstr <<
"index out of range" << std::endl;
329 throw Exception(
"vBaseVector::At", errstr.str(), 62);
345 std::stringstream errstr;
346 errstr <<
"cannot cast element " << std::endl;
347 throw Exception(
"vBaseVector::PushBack(elem)", errstr.str(), 63);
359 std::stringstream errstr;
360 errstr <<
"cannot cast element " << std::endl;
361 throw Exception(
"vBaseVector::PushBack(elem)", errstr.str(), 63);
399 #ifdef FAUDES_CHECKED
401 std::stringstream errstr;
402 errstr <<
"index out of range" << std::endl;
403 throw Exception(
"vBaseVector::FilenameAt", errstr.str(), 62);
411 #ifdef FAUDES_CHECKED
413 std::stringstream errstr;
414 errstr <<
"index out of range" << std::endl;
415 throw Exception(
"vBaseVector::FilenameAt", errstr.str(), 62);
418 mVector[pos].mFileName = rFileName;
424 for(;pit!=
mVector.end();++pit) {
425 if(pit->mMine)
continue;
426 pit->pElement=pit->pElement->Copy();
443 if(
mVector[pos].mFileName==
"") ifiles=
false;
445 std::string dirname=
"";
450 FD_DC(
"vBaseVector(" <<
this <<
")::DoWrite(..): #" <<
Size());
456 mVector[pos].pElement->Write(rTw,
"",pContext);
472 FD_DC(
"vBaseVector(" <<
this <<
")::DoWrite(..): #" <<
Size());
475 mVector[pos].pElement->DWrite(rTw,
"",pContext);
483 FD_DC(
"vBaseVector(" <<
this <<
")::DoSWrite(..)");
487 mVector[pos].pElement->SWrite(rTw);
498 std::string filename =
"";
499 std::string dirname =
"";
502 std::string label=rLabel;
503 if(label==
"") label=
"Vector";
507 while(!rTr.
Eos(label)){
519 path = dirname.append(filename);
537 std::stringstream errstr;
538 errstr <<
"token mismatch" << std::endl;
539 throw Exception(
"vBaseVector::At", errstr.str(), 50);
#define FD_DC(message)
Debug: optional report on container operations.
Classes NameSet, TaNameSet.
#define FAUDES_TYPE_IMPLEMENTATION(ftype, ctype, cbase)
faudes type implementation macros, overall
A TokenReader reads sequential tokens from a file or string.
bool Eos(const std::string &rLabel)
Peek a token and check whether it ends the specified section.
void ReadEnd(const std::string &rLabel)
Close the current section by matching the previous ReadBegin().
void ReadBegin(const std::string &rLabel)
Open a section by specified label.
bool Get(Token &token)
Get next token.
bool Peek(Token &token)
Peek next token.
std::string FileName(void) const
Access the filename.
Mode SourceMode(void) const
Access stream mode.
A TokenWriter writes sequential tokens to a file, a string or stdout.
std::string FileName(void) const
Get the filename.
void WriteComment(const std::string &rComment)
Write comment in faudes format.
void Write(Token &rToken)
Write next token.
void WriteString(const std::string &rString)
Write string.
bool FileMode(void) const
Test for file mode (incl.
void WriteEnd(const std::string &rLabel)
Write end label.
Tokens model atomic data for stream IO.
const std::string & StringValue(void) const
Get string value of a name token.
@ Begin
<label> (begin of section)
@ String
any string, space separated or quoted, must start with a letter
TokenType Type(void) const
Get token Type.
Base class of all libFAUDES objects that participate in the run-time interface.
virtual Token XBeginTag(const std::string &rLabel="", const std::string &rFallbackLabel="") const
void Read(const std::string &rFileName, const std::string &rLabel="", const Type *pContext=0)
Read configuration data from file with label specified.
virtual Type * New(void) const
Construct on heap.
virtual Type * Copy(void) const
Construct on heap.
virtual const Type * Cast(const Type *pOther) const
Cast other object to this type.
Internal entry data type.
virtual void DoSWrite(TokenWriter &rTw) const
Token output, see Type::SWrite for public wrappers.
void FilenameAt(const Position &pos, const std::string &rFileName)
Specify a filename.
virtual ~vBaseVector(void)
Virtual destructor.
virtual Type * NewElement(void)
Factory method for vector entries.
size_t Position
convenience typedef for positions (must be unsigned)
virtual const Type & At(const Position &pos) const
Access element.
bool Empty(void) const
Check if the vBaseVector ist Empty.
virtual const Type & Element(void) const
Prototype for vector entries.
virtual void Insert(const Position &pos, const Type &rElem)
Insert specified entry.
void TakeOwnership(void)
Take ownership of all entries.
virtual const Type * Elementp(void) const
Prototype for vector entries.
virtual bool ElementTry(const Type &rElement) const
Test whether the specified element is acceptebla for this vector.
std::string mMyName
Name of TBaseVector.
virtual void Erase(const Position &pos)
Erase entry by position.
virtual void DoWrite(TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
Token output, see Type::Write for public wrappers.
vBaseVector(void)
Constructor.
virtual void Append(const Type &rElem)
Append specified entry.
virtual void DoDWrite(TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
Token output, debugging see Type::DWrite for public wrappers.
void TakeCopies(void)
Take local copies of all entries.
virtual void PushBack(const Type &rElem)
Append specified entry.
virtual void Replace(const Position &pos, const Type &rElem)
Replace specified entry.
Idx Size(void) const
Get size of vector.
virtual void DoRead(TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0)
Token input, see Type::Read for public wrappers.
const std::string & Name(void) const
Return name of vBaseVector.
void DoAssign(const vBaseVector &rSourceVector)
Assignment method
std::vector< ElementRecord >::iterator iterator
convenience typedef
virtual void Clear(void)
Clear all vector.
std::vector< ElementRecord > mVector
STL vector of element.
libFAUDES resides within the namespace faudes.
uint32_t Idx
Type definition for index type (allways 32bit)
std::string ExtractDirectory(const std::string &rFullPath)
Extract directory from (full) path; i.e., remove the last separator and anything thereafer.
std::string PrependPath(const std::string &rLeft, const std::string &rRight)
Prepend one path before another.
std::string ExtractFilename(const std::string &rFullPath)
Extract file name from full path.
std::string ToStringInteger(Int number)
integer to string