32 #ifndef VLXVisitorExportToVLB_INCLUDE_ONCE 33 #define VLXVisitorExportToVLB_INCLUDE_ONCE 58 std::map< std::string, int >::iterator it = mIDSet->find(uid);
59 if (it != mIDSet->end())
60 return it->second > 1;
141 mOutputFile->writeUInt8( value.
getBool() );
155 mOutputFile->writeDouble( value.
getReal() );
182 for(
size_t i=0; i<obj->
value().size(); ++i)
197 Log::warning(
"VLXVisitorExportToVLT: cycle detected on VLXList.\n");
211 for(
size_t i=0; i<list->
value().size(); ++i)
227 if (arr->
value().size() > 0)
229 std::vector<unsigned char> encoded;
232 mOutputFile->writeUInt8(&encoded[0], encoded.size());
238 for(
size_t i=0; i<count; ++i)
240 float f = (float)in[i];
241 if ((
double)f != in[i])
259 if (arr->
value().size())
263 mOutputFile->writeDouble(&arr->
value().front(), arr->
value().size());
266 std::vector<float> floats;
267 floats.resize(arr->
value().size());
268 for(
size_t i=0; i<arr->
value().size(); ++i)
269 floats[i] = (
float)arr->
value()[i];
270 mOutputFile->writeFloat(&floats[0], floats.size());
273 std::vector<unsigned char> zipped;
276 mOutputFile->write(&zipped[0], zipped.size());
298 unsigned char vlx_identifier[] = { 0xAB,
'V',
'L',
'X', 0xBB, 0x0D, 0x0A, 0x1A, 0x0A };
300 mOutputFile->write(vlx_identifier,
sizeof(vlx_identifier));
301 mOutputFile->writeUInt16(100);
302 mOutputFile->write(
"ascii", 5+1);
303 mOutputFile->writeUInt32(0);
308 size_t len = strlen(str);
310 mOutputFile->write(str, len);
316 mOutputFile->writeSInt64(n);
318 const unsigned char nxt_flag = 0x80;
319 const unsigned char neg_flag = 0x40;
320 unsigned char bytes[12]; memset(bytes, 0,
sizeof(bytes));
321 unsigned char* byte = bytes;
328 *byte |= n & 0x3F; n >>= 6;
329 *byte |= n ? nxt_flag : 0;
334 *byte = n & 0x7F; n >>= 7;
335 *byte |= n ? nxt_flag : 0;
338 mOutputFile->write(bytes, byte - bytes);
344 const unsigned char nxt_flag = 0x80;
345 const unsigned char neg_flag = 0x40;
347 for(
int i=0; i<count; ++i)
349 unsigned char byte = 0;
350 long long n = val[i];
357 byte |= n & 0x3F; n >>= 6;
358 byte |= n ? nxt_flag : 0;
363 byte = n & 0x7F; n >>= 7;
364 byte |= n ? nxt_flag : 0;
370 void setIDSet(std::map< std::string, int >* uids) { mIDSet = uids; }
372 std::map< std::string, int >*
uidSet() {
return mIDSet; }
374 const std::map< std::string, int >*
uidSet()
const {
return mIDSet; }
391 std::map< std::string, int >* mIDSet;
VLXRawtextBlock * getRawtextBlock()
void writeString(const char *str)
const std::string & getID() const
void setOutputFile(VirtualFile *file)
An abstract class representing a file.
static void warning(const String &message)
Use this function to provide information about situations that might lead to errors or loss of data...
VLXArrayInteger * getArrayInteger()
const std::string & getString() const
virtual void acceptVisitor(VLXVisitor *v)
const std::string & getIdentifier() const
void encodeIntegers(long long *val, int count, std::vector< unsigned char > &out)
An array of 64 bits floating point numbers, can also have a tag.
virtual void visitArray(VLXArrayInteger *arr)
void writeValue(VLXValue &value)
#define VL_INSTRUMENT_CLASS(ClassName, BaseClass)
virtual void close()=0
Closes the file.
virtual void visitStructure(VLXStructure *obj)
VirtualFile * outputFile()
bool compress(const void *data, size_t size, std::vector< unsigned char > &out, int level)
void setIDSet(std::map< std::string, int > *uids)
Visualization Library main namespace.
bool isVisited(void *node)
const std::string & uid() const
virtual void visitList(VLXList *list)
VLXStructure * getStructure()
VLXVisitorExportToVLB(VirtualFile *file=NULL)
virtual void acceptVisitor(VLXVisitor *v)
const std::string & tag() const
std::vector< T > & value()
std::vector< Value > & value()
std::map< std::string, int > * uidSet()
Translates a VLX hierarchy into VLB format writing to the provided VirtualFile.
Base class for all visitors visiting a VLX hierarchy.
virtual bool open(EOpenMode mode)=0
Opens the file in the specified mode.
Wrapper for all VLX value types.
const std::map< std::string, int > * uidSet() const
An array of 64 bits integers, can also have a tag.
VLXArrayReal * getArrayReal()
virtual void acceptVisitor(VLXVisitor *v)
A simple sequence of VLXValue objects, can also have a tag.
const VirtualFile * outputFile() const
The ref<> class is used to reference-count an Object.
virtual void visitArray(VLXArrayReal *arr)
bool isUsed(const std::string &uid)
std::vector< VLXValue > & value()
bool needsDoublePrecision(const double *in, size_t count)
long long getInteger() const
void writeInteger(long long n)
A list of key/VLXValue pairs, can also have a tag.
virtual void acceptVisitor(VLXVisitor *v)