#include "mbconfig.h"
#include "parser.h"
#include "bufmod.h"
Go to the source code of this file.
bool bIsLittleEndian |
( |
void |
| ) |
|
Definition at line 287 of file bufmod.cc.
References bIsLittleEndian(), BufCast::copy(), HighParser::GetYesNoOrBool(), HighParser::IsKeyWord(), HighParser::IsWord(), ReadOneBufCast(), and SwapMapInit().
Referenced by ReadStreamContentModifier(), and ReadStreamDriveModifier().
294 const char *s = HP.
IsWord(typewordset);
297 TypeMap_t::iterator i = swapmap.find(std::string(s));
299 }
while ((s = HP.
IsWord(typewordset)) != 0);
311 for (TypeMap_t::iterator i = swapmap.begin(); i != swapmap.end(); ++i) {
319 size_t size(0), offset(0);
324 for (
size_t i = 1; i < data.size(); i++) {
326 data[i] = data[i - 1]->
copy(offset);
331 for (
size_t i = 0; i < data.size(); i++) {
void SwapMapInit(TypeMap_t &swapmap)
virtual const char * IsWord(const HighParser::WordSet &ws)
static BufCast * ReadOneBufCast(HighParser &HP, size_t &offset, TypeMap_t &swapmap, bool bNoSkip=false)
bool bIsLittleEndian(void)
virtual bool GetYesNoOrBool(bool bDefval=false)
virtual bool IsKeyWord(const char *sKeyWord)
std::map< std::string, bool > TypeMap_t
virtual BufCast * copy(size_t offset) const =0
Definition at line 146 of file bufmod.cc.
References ASSERT, HighParser::GetInt(), HighParser::GetLineData(), HighParser::IsKeyWord(), and MBDYN_EXCEPT_ARGS.
Referenced by ReadBufCast().
151 TypeMap_t::const_iterator i = swapmap.find(
typeid(int8_t).name());
158 offset +=
sizeof(int8_t);
161 TypeMap_t::const_iterator i = swapmap.find(
typeid(uint8_t).name());
168 offset +=
sizeof(uint8_t);
171 TypeMap_t::const_iterator i = swapmap.find(
typeid(int16_t).name());
178 offset +=
sizeof(int16_t);
181 TypeMap_t::const_iterator i = swapmap.find(
typeid(uint16_t).name());
188 offset +=
sizeof(uint16_t);
191 TypeMap_t::const_iterator i = swapmap.find(
typeid(int32_t).name());
198 offset +=
sizeof(int32_t);
201 TypeMap_t::const_iterator i = swapmap.find(
typeid(uint32_t).name());
208 offset +=
sizeof(uint32_t);
211 TypeMap_t::const_iterator i = swapmap.find(
typeid(
float).name());
218 offset +=
sizeof(float);
221 TypeMap_t::const_iterator i = swapmap.find(
typeid(
double).name());
228 offset +=
sizeof(double);
230 }
else if (HP.
IsKeyWord(
"skip") && !bNoSkip) {
233 silent_cerr(
"ReadOneBufCast: invalid number of bytes " << skip
234 <<
" to be skipped at line " << HP.
GetLineData() << std::endl);
243 silent_cerr(
"ReadOneBufCast: invalid number of bytes " << ioffset
244 <<
" as offset at line " << HP.
GetLineData() << std::endl);
#define MBDYN_EXCEPT_ARGS
virtual integer GetInt(integer iDefval=0)
virtual HighParser::ErrOut GetLineData(void) const
virtual bool IsKeyWord(const char *sKeyWord)
#define ASSERT(expression)
Definition at line 266 of file bufmod.cc.
Referenced by buildFGBufCast(), and ReadBufCast().
268 swapmap.insert(TypeMap_t::value_type(
typeid(int8_t).name(),
false));
269 swapmap.insert(TypeMap_t::value_type(
typeid(uint8_t).name(),
false));
270 swapmap.insert(TypeMap_t::value_type(
typeid(int16_t).name(),
false));
271 swapmap.insert(TypeMap_t::value_type(
typeid(uint16_t).name(),
false));
272 swapmap.insert(TypeMap_t::value_type(
typeid(int32_t).name(),
false));
273 swapmap.insert(TypeMap_t::value_type(
typeid(uint32_t).name(),
false));
274 swapmap.insert(TypeMap_t::value_type(
typeid(
float).name(),
false));
275 swapmap.insert(TypeMap_t::value_type(
typeid(
double).name(),
false));