MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
StringDCR Struct Reference
Inheritance diagram for StringDCR:
Collaboration diagram for StringDCR:

Public Member Functions

DriveCallerRead (const DataManager *pDM, MBDynParser &HP, bool bDeferred)
 
- Public Member Functions inherited from DriveCallerRead
virtual ~DriveCallerRead (void)
 

Additional Inherited Members

- Static Public Member Functions inherited from DriveCallerRead
static void ReadOutput (DriveCaller *pDC, const DataManager *pDM, MBDynParser &HP)
 
- Protected Member Functions inherited from DriveCallerRead
void NeedDM (const DataManager *pDM, MBDynParser &HP, bool bDeferred, const char *const name)
 

Detailed Description

Definition at line 2451 of file drive_.cc.

Member Function Documentation

DriveCaller * StringDCR::Read ( const DataManager pDM,
MBDynParser HP,
bool  bDeferred 
)
virtual

Implements DriveCallerRead.

Definition at line 2457 of file drive_.cc.

References DEBUGCOUT, EEStrOut(), HighParser::GetMathParser(), HighParser::GetStringWithDelims(), DriveCallerRead::NeedDM(), DataManager::pGetDrvHdl(), and SAFENEWWITHCONSTRUCTOR.

2458 {
2459  NeedDM(pDM, HP, bDeferred, "string");
2460 
2461  const DriveHandler* pDrvHdl = 0;
2462  if (pDM != 0) {
2463  pDrvHdl = pDM->pGetDrvHdl();
2464  }
2465 
2466  DriveCaller *pDC = 0;
2467 
2468  /* driver stringa da valutare */
2469  /* lettura dei dati specifici */
2470  std::string s(HP.GetStringWithDelims());
2471 
2472 #ifdef USE_EE
2473  std::istringstream in(s);
2474  InputStream In(in);
2475 
2476  ExpressionElement *expr = HP.GetMathParser().GetExpr(In);
2477 
2478  if (pedantic_out) {
2479  std::string out = EEStrOut(expr);
2480  pedantic_cout("StringDriveCaller: \"" << s << "\" => \"" << out << "\"" << std::endl);
2481  }
2482 
2483  /* allocazione e creazione */
2486  StringDriveCaller(pDrvHdl, s, expr));
2487 
2488 #else // ! USE_EE
2489 
2490 // #define TRIM_ALL_SPACES
2491 #define TRIM_ALL_SPACES_BUT_ONE
2492 
2493 #if defined(TRIM_ALL_SPACES)
2494  for (std::string::iterator i = s.begin(); i != s.end();) {
2495  if (isspace(*i)) {
2496  i = s.erase(i);
2497 
2498  } else {
2499  ++i;
2500  }
2501  }
2502 #elif defined(TRIM_ALL_SPACES_BUT_ONE)
2503  bool bString(false);
2504  for (std::string::iterator i = s.begin(); i != s.end();) {
2505  if (isspace(*i)) {
2506  if (!bString) {
2507  bString = true;
2508  ++i;
2509 
2510  } else {
2511  i = s.erase(i);
2512  }
2513 
2514  } else {
2515  if (bString) {
2516  bString = false;
2517  }
2518  ++i;
2519  }
2520  }
2521 #endif // TRIM_ALL_SPACES_BUT_ONE
2522 
2523  DEBUGCOUT("String to evaluate: \"" << s << '\"' << std::endl);
2524 
2525  /* allocazione e creazione */
2528  StringDriveCaller(pDrvHdl, s));
2529 
2530 #endif // ! USE_EE
2531 
2532  return pDC;
2533 }
const DriveHandler * pGetDrvHdl(void) const
Definition: dataman.h:340
#define DEBUGCOUT(msg)
Definition: myassert.h:232
virtual const char * GetStringWithDelims(enum Delims Del=DEFAULTDELIM, bool escape=true)
Definition: parser.cc:1228
std::string EEStrOut(const ExpressionElement *e)
virtual MathParser & GetMathParser(void)
Definition: parser.cc:668
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
Definition: mynewmem.h:698
void NeedDM(const DataManager *pDM, MBDynParser &HP, bool bDeferred, const char *const name)
Definition: drive_.cc:1354

Here is the call graph for this function:


The documentation for this struct was generated from the following file: