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

Go to the source code of this file.

Functions

HintParseHint (DataManager *pDM, const char *s)
 

Variables

TplDriveHint3 tdh3 (0)
 
TplDriveHint6 tdh6 (0)
 

Function Documentation

Hint* ParseHint ( DataManager pDM,
const char *  s 
)

Definition at line 37 of file hint_impl.cc.

References STRLENOF.

Referenced by SimulationEntity::ParseHint().

38 {
39  if (strncasecmp(s, "drive{", STRLENOF("drive{")) == 0) {
40  s += STRLENOF("drive{");
41 
42  size_t len = strlen(s);
43 
44  if (s[len - 1] != '}') {
45  return 0;
46  }
47 
48  char *sDriveStr = new char[len + 1];
49  memcpy(sDriveStr, s, len + 1);
50  sDriveStr[len - 1] = ';';
51 
52  return new DriveHint(sDriveStr);
53 
54  } else if (strncasecmp(s, "drive3{", STRLENOF("drive3{")) == 0) {
55  s += STRLENOF("drive3{");
56 
57  size_t len = strlen(s);
58 
59  if (s[len - 1] != '}') {
60  return 0;
61  }
62 
63  char *sDriveStr = new char[len + 1];
64  memcpy(sDriveStr, s, len + 1);
65  sDriveStr[len - 1] = ';';
66 
67  return new TplDriveHint<Vec3>(sDriveStr);
68 
69  } else if (strncasecmp(s, "drive6{", STRLENOF("drive6{")) == 0) {
70  s += STRLENOF("drive6{");
71 
72  size_t len = strlen(s);
73 
74  if (s[len - 1] != '}') {
75  return 0;
76  }
77 
78  char *sDriveStr = new char[len + 1];
79  memcpy(sDriveStr, s, len + 1);
80  sDriveStr[len - 1] = ';';
81 
82  return new TplDriveHint<Vec6>(sDriveStr);
83  }
84 
85  return 0;
86 }
#define STRLENOF(s)
Definition: mbdyn.h:166

Variable Documentation

TplDriveHint3 tdh3(0)
TplDriveHint6 tdh6(0)