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

Go to the source code of this file.

Functions

StreamDrive::ModifierReadStreamDriveModifier (MBDynParser &HP, integer nDrives)
 
StreamDriveEchoReadStreamDriveEcho (const DataManager *pDM, MBDynParser &HP)
 

Function Documentation

StreamDriveEcho* ReadStreamDriveEcho ( const DataManager pDM,
MBDynParser HP 
)

Definition at line 280 of file streamdrive.cc.

References IncludeParser::GetFileName(), HighParser::GetInt(), IncludeParser::GetLineData(), HighParser::GetReal(), HighParser::IsKeyWord(), MBDYN_EXCEPT_ARGS, and DataManager::pGetDrvHdl().

Referenced by ReadBufferStreamDrive().

281 {
282  StreamDriveEcho *pSDE(0);
283 
284  std::string sOutFileName;
285  int iPrecision = -1;
286  doublereal dShift = 0.;
287 
288  if (HP.IsKeyWord("echo")) {
289  const char *s = HP.GetFileName();
290  if (s == NULL) {
291  silent_cerr("ReadStreamDriveEcho: "
292  "unable to parse echo file name "
293  "at line " << HP.GetLineData()
294  << std::endl);
296  }
297 
298  sOutFileName = s;
299 
300  if (HP.IsKeyWord("precision")) {
301  iPrecision = HP.GetInt();
302  if (iPrecision <= 0) {
303  silent_cerr("ReadStreamDriveEcho: "
304  "invalid echo precision " << iPrecision
305  << " at line " << HP.GetLineData()
306  << std::endl);
308  }
309  }
310 
311  if (HP.IsKeyWord("shift")) {
312  dShift = HP.GetReal();
313  }
314 
315  pSDE = new StreamDriveEcho(pDM->pGetDrvHdl(), sOutFileName, iPrecision, dShift);
316  }
317 
318  return pSDE;
319 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
virtual integer GetInt(integer iDefval=0)
Definition: parser.cc:1050
virtual const char * GetFileName(enum Delims Del=DEFAULTDELIM)
Definition: parsinc.cc:673
const DriveHandler * pGetDrvHdl(void) const
Definition: dataman.h:340
virtual bool IsKeyWord(const char *sKeyWord)
Definition: parser.cc:910
double doublereal
Definition: colamd.c:52
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697
virtual doublereal GetReal(const doublereal &dDefval=0.0)
Definition: parser.cc:1056

Here is the call graph for this function:

StreamDrive::Modifier* ReadStreamDriveModifier ( MBDynParser HP,
integer  nDrives 
)

Definition at line 169 of file streamdrive.cc.

References HighParser::GetInt(), IncludeParser::GetLineData(), HighParser::IsKeyWord(), MBDYN_EXCEPT_ARGS, and ReadBufCast().

Referenced by ReadBufferStreamDrive(), and ReadRTMBDynInDrive().

170 {
171  StreamDrive::Modifier *pSDM(0);
172 
173  if (HP.IsKeyWord("copy" "cast")) {
174  std::vector<BufCast *> data(nDrives);
175  ReadBufCast(HP, data);
176  size_t minsize = data[data.size() - 1]->offset() + data[data.size() - 1]->size();
177  size_t size = minsize;
178  if (HP.IsKeyWord("size")) {
179  integer i = HP.GetInt();
180  if (i <= 0) {
181  silent_cerr("ReadStreamDriveModifier: invalid size " << i
182  << " at line " << HP.GetLineData() << std::endl);
184  }
185 
186  size = size_t(i);
187  if (size < minsize) {
188  silent_cerr("ReadStreamDriveModifier: size " << size
189  << " is less than min size " << minsize
190  << " at line " << HP.GetLineData() << std::endl);
192  }
193  }
194 
195  pSDM = new StreamDriveCopyCast(size, data);
196 
197  } else if (!HP.IsKeyWord("copy")) {
198  // TODO: "copy" with byte swap for network-independent stuff...
199  silent_cerr("ReadStreamDriveModifier: unknown modifier type at line " << HP.GetLineData() << std::endl);
201  }
202 
203  return pSDM;
204 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
virtual integer GetInt(integer iDefval=0)
Definition: parser.cc:1050
virtual bool IsKeyWord(const char *sKeyWord)
Definition: parser.cc:910
void ReadBufCast(HighParser &HP, std::vector< BufCast * > &data)
Definition: bufmod.cc:287
long int integer
Definition: colamd.c:51
virtual HighParser::ErrOut GetLineData(void) const
Definition: parsinc.cc:697

Here is the call graph for this function: