MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
bufferstream_out_elem.cc File Reference
#include "mbconfig.h"
#include <sstream>
#include "dataman.h"
#include "bufferstream_out_elem.h"
Include dependency graph for bufferstream_out_elem.cc:

Go to the source code of this file.

Functions

ElemReadBufferStreamElem (DataManager *pDM, MBDynParser &HP, unsigned int uLabel, StreamContent::Type type)
 

Function Documentation

Elem* ReadBufferStreamElem ( DataManager pDM,
MBDynParser HP,
unsigned int  uLabel,
StreamContent::Type  type 
)

Definition at line 230 of file bufferstream_out_elem.cc.

References ASSERT, HighParser::GetInt(), IncludeParser::GetLineData(), HighParser::GetYesNoOrBool(), HighParser::IsArg(), HighParser::IsKeyWord(), MBDYN_EXCEPT_ARGS, ReadStreamContent(), ReadStreamOutEcho(), and SAFENEWWITHCONSTRUCTOR.

Referenced by ReadOutputElem().

231 {
232  enum {
233  STL,
234  RAW
235  } eType = STL;
236  bool bOwnsMemory(true);
237 
238  if (HP.IsKeyWord("type")) {
239  if (HP.IsKeyWord("raw")) {
240  eType = RAW;
241  if (HP.IsKeyWord("owns" "memory")) {
242  bOwnsMemory = HP.GetYesNoOrBool();
243  }
244 
245  } else if (!HP.IsKeyWord("stl")) {
246  silent_cerr("BufferStreamDrive"
247  "(" << uLabel << "\"): "
248  "invalid type at line " << HP.GetLineData()
249  << std::endl);
251  }
252  }
253 
254  unsigned int OutputEvery = 1;
255  if (HP.IsKeyWord("output" "every")) {
256  int i = HP.GetInt();
257  if (i <= 0) {
258  silent_cerr("BufferStreamElem(" << uLabel << "): "
259  "invalid output every value " << i << " "
260  "at line " << HP.GetLineData() << std::endl);
262  }
263  OutputEvery = (unsigned int)i;
264  }
265 
266  StreamOutEcho *pSOE = ReadStreamOutEcho(HP);
267  StreamContent *pSC = ReadStreamContent(pDM, HP, type);
268 
269  /* Se non c'e' il punto e virgola finale */
270  if (HP.IsArg()) {
271  silent_cerr("BufferStreamElem(" << uLabel << "): "
272  "semicolon expected "
273  "at line " << HP.GetLineData() << std::endl);
275  }
276 
277  Elem *pEl = 0;
278  switch (eType) {
279  case STL:
281  BufferStreamElem(uLabel, OutputEvery, pSC, pSOE));
282  break;
283 
284  case RAW:
286  BufferStreamElemRaw(uLabel, OutputEvery, pSC, pSOE, bOwnsMemory));
287  break;
288 
289  default:
290  ASSERT(0);
291  break;
292  }
293 
294  return pEl;
295 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
virtual integer GetInt(integer iDefval=0)
Definition: parser.cc:1050
virtual bool GetYesNoOrBool(bool bDefval=false)
Definition: parser.cc:1038
StreamContent * ReadStreamContent(DataManager *pDM, MBDynParser &HP, StreamContent::Type type)
StreamOutEcho * ReadStreamOutEcho(MBDynParser &HP)
virtual bool IsKeyWord(const char *sKeyWord)
Definition: parser.cc:910
#define ASSERT(expression)
Definition: colamd.c:977
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
virtual bool IsArg(void)
Definition: parser.cc:807
Definition: elem.h:75
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697

Here is the call graph for this function: