Version: 9.15.0
Any.cxx
Go to the documentation of this file.
1 // Copyright (C) 2006-2025 CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #include "Any.hxx"
21 #include "Runtime.hxx"
22 #include "TypeCode.hxx"
24 
25 #include <boost/archive/iterators/base64_from_binary.hpp>
26 #include <boost/archive/iterators/binary_from_base64.hpp>
27 #include <boost/archive/iterators/transform_width.hpp>
28 #include <boost/archive/iterators/insert_linebreaks.hpp>
29 #include <boost/archive/iterators/remove_whitespace.hpp>
30 
31 #include <algorithm>
32 #include <cstring>
33 #include <cstdlib>
34 
35 using namespace YACS::ENGINE;
36 using namespace std;
37 
38 // forbidden value int=-269488145 double=-1.54947e+231 bool=239
39 const char SeqAlloc::DFT_CHAR_VAR=-17;//0xEF
40 
41 constexpr unsigned NB_BITS = 6;
42 
43 constexpr unsigned char TAB[64]={46, 61, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122};
44 
45 unsigned char BitAtPosSimple(char val, std::size_t bitPos)
46 {
47  return (val >> bitPos) & 0x1;
48 }
49 
50 unsigned char BitAtPos(char pt0, char pt1, std::size_t bitPos)
51 {
52  if(bitPos<8)
53  return BitAtPosSimple(pt0,bitPos);
54  else
55  return BitAtPosSimple(pt1,bitPos-8);
56 }
57 
58 unsigned char ChunkInternal(char pt0, char pt1, std::size_t startBitIdInByte)
59 {
60  unsigned char ret(0);
61  for(unsigned i = 0; i<NB_BITS; ++i)
62  {
63  ret |= BitAtPos(pt0,pt1,startBitIdInByte+i);
64  ret <<= 1;
65  }
66  ret >>= 1;
67  return ret;
68 }
69 
70 unsigned char ChunkAtPos(const char *pt, std::size_t len, std::size_t posChunk)
71 {
72  std::size_t startByte((posChunk*NB_BITS)/8);
73  std::size_t startBitIdInByte((posChunk*NB_BITS)%8);
74  char pt1(startByte!=len-1?pt[startByte+1]:pt[startByte]);
75  return ChunkInternal(pt[startByte],pt1,startBitIdInByte);
76 }
77 
78 std::size_t OnOff(std::size_t i)
79 {
80  if(i!=0)
81  return 1;
82  return 0;
83 }
84 
85 std::string YACS::ENGINE::ToBase64(const std::string& bytes)
86 {//64 == 2**6
87  const char *bytesPt(bytes.c_str());
88  std::size_t input_len(bytes.size());
89  std::size_t input_len_bit(input_len*8);
90  std::size_t nb_chunks( input_len_bit/NB_BITS + OnOff((NB_BITS - input_len_bit%NB_BITS)%NB_BITS) );
91  std::string ret(nb_chunks,'\0');
92  for(std::size_t i=0;i<nb_chunks;++i)
93  {
94  unsigned char cp(ChunkAtPos(bytesPt,input_len, i));
95  ret[i] = TAB[cp];
96  }
97  return ret;
98 }
99 
100 constexpr unsigned MAX_VAL_TAB2=123;
101 
102 constexpr unsigned NOT_OK_VAL = 128;
103 
105 
106 unsigned char BitAtPosSimple2(char val, std::size_t bitPos)
107 {
108  return ( val >> (5-bitPos) ) & 0x1;
109 }
110 
111 char BitAtPosOnChunk(char pt0, char pt1, std::size_t bitPos)
112 {
113  if(bitPos<6)
114  return BitAtPosSimple2(pt0,bitPos);
115  else
116  return BitAtPosSimple2(pt1,bitPos-6);
117 }
118 
119 unsigned char CheckEntry(char c)
120 {
121  if( ((unsigned) c) < MAX_VAL_TAB2 )
122  {
123  unsigned char ret(TAB2[(unsigned char)c]);
124  if(ret != NOT_OK_VAL)
125  return ret;
126  throw YACS::Exception("Invalid character found !");
127  }
128  throw YACS::Exception("Invalid character found !");
129 }
130 
131 char ByteInternal(char c0, char c1, std::size_t startBitIdInByte)
132 {
133  unsigned char ret(0);
134  char ct0(CheckEntry(c0)),ct1(CheckEntry(c1));
135  for(int i = 7; i>=0; --i)
136  {
137  ret |= BitAtPosOnChunk(ct0,ct1,startBitIdInByte+i);
138  if(i!=0)
139  ret <<= 1;
140  }
141  return ret;
142 }
143 
144 char ByteAtPos(const char *chunckPt, std::size_t bytePos)
145 {
146  std::size_t startChunk((bytePos*8)/NB_BITS);
147  std::size_t startBitId((bytePos*8)%NB_BITS);
148  return ByteInternal(chunckPt[startChunk],chunckPt[startChunk+1],startBitId);
149 }
150 
151 std::string YACS::ENGINE::FromBase64(const std::string& bytes)
152 {
153  std::size_t nb_chunks(bytes.size());
154  const char *chunckPt(bytes.c_str());
155  std::size_t nb_bytes_output((nb_chunks*NB_BITS)/8);
156  std::string ret(nb_bytes_output,'\0');
157  for(std::size_t i = 0; i<nb_bytes_output; ++i)
158  {
159  ret[i] = ByteAtPos(chunckPt,i);
160  }
161  return ret;
162 }
163 
167 std::string YACS::ENGINE::FromBase64Safe(const std::string& bytes)
168 {
169  try
170  {
171  return FromBase64(bytes);
172  }
173  catch(const YACS::Exception& e)
174  {
175  return bytes;
176  }
177 }
178 
179 StringOnHeap::StringOnHeap(const char *val):_str(strdup(val)),_len(strlen(val)),_dealloc(0)
180 {
181 }
182 
183 StringOnHeap::StringOnHeap(const char *val, std::size_t len):_dealloc(0),_len(len)
184 {
185  _str=(char *)malloc(len+1);
186  std::copy(val,val+len,_str);
187  _str[len]='\0';
188 }
189 
190 StringOnHeap::StringOnHeap(const std::string& val):_dealloc(0),_len(val.size()),_str(nullptr)
191 {
192  _str=(char *)malloc(val.size()+1);
193  std::copy(val.cbegin(),val.cend(),_str);
194  _str[val.size()]='\0';
195 }
196 
204 StringOnHeap::StringOnHeap(char *val, Deallocator deAlloc):_len(0),_dealloc(deAlloc)
205 {
206  if(deAlloc)
207  _str=val;
208  else
209  _str=strdup(val);
210 }
211 
212 bool StringOnHeap::operator ==(const StringOnHeap& other) const
213 {
214  return strcmp(_str, other._str)==0;
215 }
216 
218 {
219  if(_len==0)
220  return new StringOnHeap(_str);
221  else
222  return new StringOnHeap(_str,_len);
223 }
224 
226 {
227  if(_dealloc)
228  _dealloc(_str);
229  else
230  free(_str);
231 }
232 
233 Any::Any(TypeCode* type):_type(type)
234 {
235  _type->incrRef();
236 }
237 
238 Any::Any(const Any& other):_type(other._type)
239 {
240  _type->incrRef();
241 }
242 
244 {
245  _type->decrRef();
246 }
247 
248 bool Any::IsNull(char *data)
249 {
250  if(!data)
251  return true;
252  bool isNull(true);
253  for(std::size_t i=0;i<sizeof(void *) && isNull;i++)
254  isNull=(data[i]==SeqAlloc::DFT_CHAR_VAR);
255  return isNull;
256 }
257 
258 AtomAny::AtomAny(int val):Any(Runtime::_tc_int)
259 {
260  _value._i=val;
261 }
262 
263 AtomAny::AtomAny(bool val):Any(Runtime::_tc_bool)
264 {
265  _value._b=val;
266 }
267 
268 AtomAny::AtomAny(double val):Any(Runtime::_tc_double)
269 {
270  _value._d=val;
271 }
272 
273 AtomAny::AtomAny(const char *val):Any(Runtime::_tc_string)
274 {
275  _value._s=new StringOnHeap(val);
276 }
277 
278 AtomAny::AtomAny(const std::string& val):Any(Runtime::_tc_string)
279 {
280  _value._s=new StringOnHeap(val);
281 }
282 
283 AtomAny::AtomAny(const std::string& val, TypeCode* type):Any(type)
284 {
285  _value._s=new StringOnHeap(val);
286 }
287 
288 AtomAny::AtomAny(const AtomAny& other):Any(other)
289 {
291  {
292  StringOnHeap *cpy=(other._value._s)->deepCopy();
293  memcpy(&_value._s,&cpy,_type->getSizeInByteOfAnyReprInSeq());
294  }
295  else if(_type->isA(Runtime::_tc_double))
296  memcpy(&_value._d,&other._value._d,_type->getSizeInByteOfAnyReprInSeq());
297  else if(_type->isA(Runtime::_tc_int))
298  memcpy(&_value._i,&other._value._i,_type->getSizeInByteOfAnyReprInSeq());
299  else if(_type->isA(Runtime::_tc_bool))
300  memcpy(&_value._b,&other._value._b,_type->getSizeInByteOfAnyReprInSeq());
301 }
302 
303 AtomAny::AtomAny(char *val, Deallocator deAlloc):Any(Runtime::_tc_string)
304 {
305  _value._s=new StringOnHeap(val,deAlloc);
306 }
307 
308 AtomAny::AtomAny(char *data, TypeCode* type):Any(type)
309 {
311  {
312  void **tmp=(void **)data;
313  StringOnHeap *cpy=((StringOnHeap *)(*tmp))->deepCopy();
314  memcpy(&_value._s,&cpy,type->getSizeInByteOfAnyReprInSeq());
315  }
316  else if(type->isA(Runtime::_tc_double))
317  memcpy(&_value._d,data,type->getSizeInByteOfAnyReprInSeq());
318  else if(type->isA(Runtime::_tc_int))
319  memcpy(&_value._i,data,type->getSizeInByteOfAnyReprInSeq());
320  else if(type->isA(Runtime::_tc_bool))
321  memcpy(&_value._b,data,type->getSizeInByteOfAnyReprInSeq());
322 }
323 
325 {
326  return new AtomAny(*this);
327 }
328 
329 AtomAny *AtomAny::New(char *val,Deallocator dealloc)
330 {
331  return new AtomAny(val,dealloc);
332 }
333 
334 AtomAny *AtomAny::New(const std::string& val, TypeCode *type)
335 {
336  return new AtomAny(val,type);
337 }
338 
340 {
342 }
343 
344 AnyPtr AtomAny::operator[](const char *key) const
345 {
346  throw Exception("AtomAny::operator[] : try to get a part of a partitionned data whereas atomical.");
347 }
348 
349 bool AtomAny::operator ==(const Any& other) const
350 {
351  if(!_type->isA(other.getType()))
352  return false;
353  const AtomAny& otherC=(const AtomAny&) other;//cast granted due to previous lines
355  return _value._d==otherC._value._d;
356  else if(_type->isA(Runtime::_tc_int))
357  return _value._i==otherC._value._i;
358  else if(_type->isA(Runtime::_tc_bool))
359  return _value._b==otherC._value._b;
360  else if(_type->isA(Runtime::_tc_string) || _type->kind()==Objref)
361  return (*_value._s)==*(otherC._value._s);
362  else
363  return false;
364 }
365 
367 {
369  return _value._i;
370  else
371  throw Exception("Value is not an int");
372 }
373 
375 {
377  return _value._b;
378  else
379  throw Exception("Value is not a bool");
380 }
381 
383 {
385  return _value._d;
386  else
387  throw Exception("Value is not a double");
388 }
389 
390 std::string AtomAny::getStringValue() const
391 {
393  {
394  std::size_t sz(_value._s->size());
395  if(sz==0)
396  return string(_value._s->cStr());
397  else
398  return string(_value._s->cStr(),sz);
399  }
400  else
401  throw Exception("Value is not a string");
402 }
403 
404 const char *AtomAny::getBytesValue(std::size_t& len) const
405 {
407  {
408  len=_value._s->size();
409  return _value._s->cStr();
410  }
411  else
412  throw Exception("Value is not a string");
413 }
414 
422 void AtomAny::putMyReprAtPlace(char *data) const
423 {
425  {
426  StringOnHeap *tmp=_value._s->deepCopy();
427  memcpy(data,&tmp,_type->getSizeInByteOfAnyReprInSeq());
428  }
429  else if(_type->isA(Runtime::_tc_double))
430  memcpy(data,&_value._d,_type->getSizeInByteOfAnyReprInSeq());
431  else if(_type->isA(Runtime::_tc_int))
432  memcpy(data,&_value._i,_type->getSizeInByteOfAnyReprInSeq());
433  else if(_type->isA(Runtime::_tc_bool))
434  memcpy(data,&_value._b,_type->getSizeInByteOfAnyReprInSeq());
435 }
436 
448 void AtomAny::putReprAtPlace(char *data, const char *src, const TypeCode *type, bool deepCpy)
449 {
450  if(type->isA(Runtime::_tc_string) || type->kind()==YACS::ENGINE::Objref)
451  {
452  void **tmp1=(void **)src;
453  StringOnHeap *tmp=((const StringOnHeap *)(*tmp1))->deepCopy();
454  memcpy(data,&tmp,type->getSizeInByteOfAnyReprInSeq());
455  }
456  else if(type->isA(Runtime::_tc_double))
457  memcpy(data,src,type->getSizeInByteOfAnyReprInSeq());
458  else if(type->isA(Runtime::_tc_int))
459  memcpy(data,src,type->getSizeInByteOfAnyReprInSeq());
460  else if(type->isA(Runtime::_tc_bool))
461  memcpy(data,src,type->getSizeInByteOfAnyReprInSeq());
462 }
463 
468 void AtomAny::destroyReprAtPlace(char *data, const TypeCode *type)
469 {
470  DynType typ=type->kind();
471  if(typ==String || typ==Objref)
472  {
473  if(!Any::IsNull(data))
474  {
475  void **tmp=(void **)data;
476  delete ((StringOnHeap *)(*tmp));
477  }
478  }
479 }
480 
482 {
483  Any *ret;
484  ret=new AtomAny(data,(TypeCode *)type);
485  return AnyPtr(ret);
486 }
487 
489 {
490  DynType typ=type->kind();
491  return (typ==Double || typ==Int || typ==Bool || typ==String);
492 }
493 
495 {
496  if(_type->kind() == String || _type->kind()==Objref)
497  delete _value._s;
498 }
499 
501 {
502 }
503 
504 ComposedAny::ComposedAny(TypeCode* type, bool isNew):Any(type)
505 {
506  if(isNew)
507  _type->decrRef();
508 }
509 
510 AnyPtr ComposedAny::operator[](const char *key) const
511 {
512  throw Exception("AtomAny::operator[] : try to get a part of a partitionned data not localizable by a string.");
513 }
514 
515 void ComposedAny::checkTypeOf(const Any *elem) const
516 {
517  if(!elem->getType()->isA(_type->contentType()))
518  throw Exception("ComposedAny::checkTypeOf : invalid type.");
519 }
520 
522 {
524 }
525 
527 {
529 }
530 
532 {
534 }
535 
536 std::string ComposedAny::getStringValue() const
537 {
539 }
540 
541 SeqAlloc::SeqAlloc(const SeqAlloc& other):_sizeOf1Elm(other._sizeOf1Elm),_notStdDeAlloc(0),
542  _start(0),_finish(0),_endOfStorage(0)
543 {
544  _start=allocate(other._finish-other._start);
545  _finish=_start+(other._finish-other._start);
547 }
548 
549 SeqAlloc::SeqAlloc(unsigned int sizeOf1Elm):_sizeOf1Elm(sizeOf1Elm),_notStdDeAlloc(0),
550  _start(0),_finish(0),_endOfStorage(0)
551 {
552 }
553 
555 {
557 }
558 
560 {
562  _start=0;
563  _finish=0;
564  _endOfStorage=0;
565 }
566 
571 void SeqAlloc::initCoarseMemory(char *mem, unsigned int size, Deallocator dealloc)
572 {
573  unsigned sizeInByte=size*_sizeOf1Elm;
574  if(dealloc)
575  {
576  _notStdDeAlloc=dealloc;
577  _start=mem;
578  }
579  else
580  {
581  _start=allocate(sizeInByte);
582  if(mem)
583  memcpy(_start,mem,sizeInByte);
584  else
585  {
586  for(unsigned int i=0;i<sizeInByte;i++) _start[i]=DFT_CHAR_VAR;// see getSetItems
587  }
588  }
589  _finish=_start+sizeInByte;
591 }
592 
593 void SeqAlloc::construct(char *pt, const Any *val)
594 {
595  val->putMyReprAtPlace(pt);
596 }
597 
605 void SeqAlloc::construct(char *pt, const char *val, const TypeCode *tc, bool deepCpy)
606 {
607  tc->putReprAtPlace(pt,val,deepCpy);
608 }
609 
610 char *SeqAlloc::allocate(unsigned int nbOfByte)
611 {
612  if(nbOfByte>0)
613  return (char *)::operator new(nbOfByte);
614  else
615  return 0;
616 }
617 
618 // pt is not permitted to be a null pointer.
619 void SeqAlloc::deallocate(char *pt)
620 {
621  if(pt)
622  {
623  if(!_notStdDeAlloc)
624  ::operator delete(pt);
625  else
626  {
627  _notStdDeAlloc(pt);
628  _notStdDeAlloc=0;
629  }
630  }
631 }
632 
633 void SeqAlloc::destroy(char *pt, const TypeCode *tc)
634 {
635  tc->destroyZippedAny(pt);
636 }
637 
638 unsigned int SeqAlloc::size() const
639 {
640  return (_finish-_start)/_sizeOf1Elm;
641 }
642 
643 std::vector<unsigned int> SeqAlloc::getSetItems() const
644 {
645  std::vector<unsigned int> ret;
646  unsigned int sz(size());
647  for(unsigned int i=0;i<sz;i++)
648  {
649  const char *pt(_start+i*_sizeOf1Elm);
650  for(unsigned j=0;j<_sizeOf1Elm && *pt==DFT_CHAR_VAR;j++,pt++); //see initCoarseMemory
651  if(pt!=_start+(i+1)*_sizeOf1Elm)
652  ret.push_back(i);
653  }
654  return ret;
655 }
656 
658 {
659  for (char *cur=_alloc._start;cur!=_alloc._finish;cur+=_alloc._sizeOf1Elm)
661  _alloc.clear();
662 }
663 
665 {
668 }
669 
670 void SequenceAny::pushBack(const Any* elem)
671 {
672  if(!elem->_type->isA(_type->contentType()))
675  {
678  }
679  else
680  realloc(_alloc._finish, elem);
681 }
682 
683 bool SequenceAny::operator ==(const Any& other) const
684 {
685  if(!_type->isA(other.getType()))
686  return false;
687  const SequenceAny& otherC=(const SequenceAny&) other;//cast granted due to previous lines
688  if(size()!=otherC.size())
689  return false;
690  for(unsigned i=0;i<size();i++)
691  if(!((*(*this)[i])==(*otherC[i])))
692  return false;
693  return true;
694 }
695 
696 void SequenceAny::setEltAtRank(int i, const Any *elem)
697 {
698  checkTypeOf(elem);
701 }
702 
704 {
706 }
707 
712 void SequenceAny::putMyReprAtPlace(char *data) const
713 {
714  const void *tmp=(const void *)this;
715  memcpy(data,&tmp,_type->getSizeInByteOfAnyReprInSeq());
716  const void **tmp2=(const void **) data;
717  ((SequenceAny *)(*tmp2))->incrRef();
718  //::new((SequenceAny *)data) SequenceAny((SequenceAny&) (*this));
719 }
720 
721 void SequenceAny::putReprAtPlace(char *data, const char *src, const TypeCode *type, bool deepCpy)
722 {
723  void **tmp2=(void **) src;
724  if(!deepCpy)
725  {
726  ((SequenceAny *)(*tmp2))->incrRef();
727  memcpy(data,src,type->getSizeInByteOfAnyReprInSeq());
728  }
729  else
730  {
731  SequenceAny *cpy=new SequenceAny(*((SequenceAny *)(*tmp2)));
732  memcpy(data,&cpy,type->getSizeInByteOfAnyReprInSeq());
733  }
734  //::new((SequenceAny *)data) SequenceAny((SequenceAny&) (*this));
735 }
736 
737 void SequenceAny::destroyReprAtPlace(char *data, const TypeCode *type)
738 {
739  void **tmp=(void **) data;
740  if(!Any::IsNull(data))
741  ((SequenceAny *)(*tmp))->decrRef();
742  //((SequenceAny *)data)->~SequenceAny();
743 }
744 
746 {
747  void **tmp=(void **) data;
748  ((SequenceAny *) (*tmp))->incrRef();
749  return AnyPtr((SequenceAny *)(*tmp));
750 }
751 
753 {
754  return new SequenceAny(*this);
755 }
756 
758 {
759  std::vector<unsigned int> its(getSetItems());
760  std::size_t sz(its.size());
761  SequenceAny *ret(SequenceAny::New(getType()->contentType(),sz));
762  for(std::size_t i=0;i<sz;i++)
763  {
764  AnyPtr obj((*this)[its[i]]);
765  ret->setEltAtRank(i,obj);
766  }
767  return ret;
768 }
769 
770 SequenceAny *SequenceAny::New(const TypeCode *typeOfContent)
771 {
772  return new SequenceAny(typeOfContent);
773 }
774 
775 SequenceAny *SequenceAny::New(const TypeCode *typeOfContent, unsigned lgth)
776 {
777  return new SequenceAny(typeOfContent,lgth);
778 }
779 
781 {
782  DynType typ=type->kind();
783  return (typ==Sequence);
784 }
785 
786 SequenceAny::SequenceAny(const SequenceAny& other):ComposedAny(other),_alloc(other._alloc)
787 {
788  const char *srcCur=other._alloc._start;
789  for(char *cur=_alloc._start;srcCur != other._alloc._finish; srcCur+=_alloc._sizeOf1Elm, cur+=_alloc._sizeOf1Elm)
790  _alloc.construct(cur, srcCur, _type->contentType(),true);
791 }
792 
794 {
795  for (char *cur=_alloc._start;cur!=_alloc._finish;cur+=_alloc._sizeOf1Elm)
797 }
798 
802 SequenceAny::SequenceAny(const TypeCode *typeOfContent):ComposedAny(new TypeCodeSeq("","",typeOfContent)),
803  _alloc(typeOfContent->getSizeInByteOfAnyReprInSeq())
804 {
805 }
806 
807 SequenceAny::SequenceAny(const TypeCode *typeOfContent, unsigned lgth):ComposedAny(new TypeCodeSeq("","",typeOfContent)),
808  _alloc(typeOfContent->getSizeInByteOfAnyReprInSeq())
809 {
810  _alloc.initCoarseMemory(0,lgth,0);
811 }
812 
813 SequenceAny::SequenceAny(int *val, unsigned int lgth, Deallocator deAlloc):ComposedAny(new TypeCodeSeq("","",Runtime::_tc_int)),
814  _alloc(Runtime::_tc_int->getSizeInByteOfAnyReprInSeq())
815 {
816  _alloc.initCoarseMemory((char *)val,lgth,deAlloc);
817 }
818 
819 SequenceAny::SequenceAny(bool *val, unsigned int lgth, Deallocator deAlloc):ComposedAny(new TypeCodeSeq("","",Runtime::_tc_bool)),
820  _alloc(Runtime::_tc_bool->getSizeInByteOfAnyReprInSeq())
821 {
822  _alloc.initCoarseMemory((char *)val,lgth,deAlloc);
823 }
824 
825 SequenceAny::SequenceAny(double *val, unsigned int lgth, Deallocator deAlloc):ComposedAny(new TypeCodeSeq("","",Runtime::_tc_double)),
826  _alloc(Runtime::_tc_double->getSizeInByteOfAnyReprInSeq())
827 {
828  _alloc.initCoarseMemory((char *)val,lgth,deAlloc);
829 }
830 
831 SequenceAny::SequenceAny(const std::vector<int>& val):ComposedAny(new TypeCodeSeq("","",Runtime::_tc_int)),
832  _alloc(Runtime::_tc_int->getSizeInByteOfAnyReprInSeq())
833 {
834  _alloc.initCoarseMemory((char *)&val[0],val.size(),0);
835 }
836 
837 SequenceAny::SequenceAny(const std::vector<bool>& val):ComposedAny(new TypeCodeSeq("","",Runtime::_tc_bool)),
838  _alloc(Runtime::_tc_bool->getSizeInByteOfAnyReprInSeq())
839 {
840  for(vector<bool>::const_iterator iter=val.begin();iter!=val.end();iter++)
841  {
842  AtomAnyPtr tmp=AtomAny::New(*iter);
843  pushBack(tmp);
844  }
845 }
846 
847 SequenceAny::SequenceAny(const std::vector<double>& val):ComposedAny(new TypeCodeSeq("","",Runtime::_tc_double)),
848  _alloc(Runtime::_tc_double->getSizeInByteOfAnyReprInSeq())
849 {
850  _alloc.initCoarseMemory((char *)&val[0],val.size(),0);
851 }
852 
853 SequenceAny::SequenceAny(const std::vector<std::string>& val):ComposedAny(new TypeCodeSeq("","",Runtime::_tc_string)),
854  _alloc(Runtime::_tc_string->getSizeInByteOfAnyReprInSeq())
855 {
856  for(vector<string>::const_iterator iter=val.begin();iter!=val.end();iter++)
857  {
858  AtomAnyPtr tmp=AtomAny::New(*iter);
859  pushBack(tmp);
860  }
861 }
862 
863 void SequenceAny::realloc(char *endOfCurrentAllocated, const Any *elem)
864 {
865  unsigned int oldSize=_alloc._finish-_alloc._start;
866  unsigned int newSize = oldSize != 0 ? 2 * oldSize : _alloc._sizeOf1Elm;
867  char *newStart=_alloc.allocate(newSize);
868  //
869  char *newFinish=performCpy(_alloc._start, endOfCurrentAllocated,newStart);
870  _alloc.construct(newFinish, elem);
871  newFinish+=_alloc._sizeOf1Elm;
872  newFinish=performCpy(endOfCurrentAllocated, _alloc._finish, newFinish);
873  //
874  for (char *cur=_alloc._start;cur!=_alloc._finish;cur+=_alloc._sizeOf1Elm)
877  _alloc._start = newStart;
878  _alloc._finish = newFinish;
879  _alloc._endOfStorage=newStart+newSize;
880 }
881 
882 char *SequenceAny::performCpy(char *srcStart, char *srcFinish, char *destStart)
883 {
884  char *cur=destStart;
885  for (;srcStart != srcFinish; srcStart+=_alloc._sizeOf1Elm, cur+=_alloc._sizeOf1Elm)
886  _alloc.construct(cur, srcStart, _type->contentType(),false);
887  return cur;
888 }
889 
891 {
892  const TypeCode *subType=_type->contentType();
893  unsigned sizePerContent=subType->getSizeInByteOfAnyReprInSeq();
894  unsigned int size=((TypeCodeArray *)_type)->getStaticLgth();
895  char *tmp=_data;
896  for(unsigned i=0;i<size;i++,tmp+=sizePerContent)
897  subType->destroyZippedAny(tmp);
898  delete [] _data;
899 }
900 
901 ArrayAny::ArrayAny(const TypeCode *typeOfContent, unsigned int lgth):ComposedAny(new TypeCodeArray("","",typeOfContent,lgth))
902 {
904  for(unsigned int i=0;i<_type->getSizeInByteOfAnyReprInSeq();i++)
906 }
907 
908 ArrayAny::ArrayAny(char *data, TypeCodeArray * type):ComposedAny(type,false),_data(0)
909 {
911  const TypeCode *subType=_type->contentType();
912  unsigned sizePerContent=subType->getSizeInByteOfAnyReprInSeq();
913  for(unsigned i=0;i<type->getStaticLgth();i++)
914  subType->putReprAtPlace(_data+i*sizePerContent,data+i*sizePerContent,false);
915 }
916 
918 {
920  const TypeCode *subType=_type->contentType();
921  unsigned sizePerContent=subType->getSizeInByteOfAnyReprInSeq();
922  for(unsigned i=0;i<((TypeCodeArray *)_type)->getStaticLgth();i++)
923  subType->putReprAtPlace(_data+i*sizePerContent,other._data+i*sizePerContent,true);
924 }
925 
926 ArrayAny::ArrayAny(const int *val, unsigned int lgth):ComposedAny(new TypeCodeArray("","",Runtime::_tc_int,lgth)),
927  _data(0)
928 {
930  memcpy(_data,val,_type->getSizeInByteOfAnyReprInSeq());
931 }
932 
933 ArrayAny::ArrayAny(const bool *val, unsigned int lgth):ComposedAny(new TypeCodeArray("","",Runtime::_tc_bool,lgth)),
934  _data(0)
935 {
937  memcpy(_data,val,_type->getSizeInByteOfAnyReprInSeq());
938 }
939 
940 ArrayAny::ArrayAny(const double *val, unsigned int lgth):ComposedAny(new TypeCodeArray("","",Runtime::_tc_double,lgth)),
941  _data(0)
942 {
944  memcpy(_data,val,_type->getSizeInByteOfAnyReprInSeq());
945 }
946 
947 ArrayAny::ArrayAny(const std::vector<int>& val):ComposedAny(new TypeCodeArray("","",Runtime::_tc_int,val.size())),
948  _data(0)
949 {
951  memcpy(_data,&val[0],_type->getSizeInByteOfAnyReprInSeq());
952 }
953 
954 ArrayAny::ArrayAny(const std::vector<double>& val):ComposedAny(new TypeCodeArray("","",Runtime::_tc_double,val.size())),
955  _data(0)
956 {
958  memcpy(_data,&val[0],_type->getSizeInByteOfAnyReprInSeq());
959 }
960 
961 ArrayAny::ArrayAny(const std::vector<std::string>& val):ComposedAny(new TypeCodeArray("","",Runtime::_tc_string,val.size())),
962  _data(0)
963 {
965  unsigned i=0;
966  const TypeCode *subType=_type->contentType();
967  unsigned sizePerContent=subType->getSizeInByteOfAnyReprInSeq();
968  for(vector<std::string>::const_iterator iter=val.begin();iter!=val.end();iter++,i++)
969  {
970  StringOnHeap *st=new StringOnHeap(*iter);
971  memcpy(_data+i*sizePerContent,&st,sizePerContent);
972  }
973 }
974 
975 void ArrayAny::setEltAtRank(int i, const Any *elem)
976 {
977  checkTypeOf(elem);
978  const TypeCode *subType=_type->contentType();
981 }
982 
983 bool ArrayAny::operator ==(const Any& other) const
984 {
985  if(!_type->isA(other.getType()))
986  return false;
987  const ArrayAny& otherC=(const ArrayAny&) other;//cast granted due to previous lines
988  for(unsigned i=0;i<((const TypeCodeArray *)_type)->getStaticLgth();i++)
989  if(!((*(*this)[i])==(*otherC[i])))
990  return false;
991  return true;
992 }
993 
995 {
996  const TypeCode *subType=_type->contentType();
997  unsigned sizePerContent=subType->getSizeInByteOfAnyReprInSeq();
998  if(i<0 || i>=((TypeCodeArray *)_type)->getStaticLgth())
999  throw Exception("Trying to access to an invalid index in an Any Tuple");
1000  return _type->contentType()->getOrBuildAnyFromZippedData(_data+i*sizePerContent);
1001 }
1002 
1003 unsigned int ArrayAny::size() const
1004 {
1005  return ((TypeCodeArray *)_type)->getStaticLgth();
1006 }
1007 
1009 {
1010  return new ArrayAny(*this);
1011 }
1012 
1013 ArrayAny *ArrayAny::New(const TypeCode *typeOfContent, unsigned int lgth)
1014 {
1015  return new ArrayAny(typeOfContent,lgth);
1016 }
1017 
1018 void ArrayAny::putMyReprAtPlace(char *data) const
1019 {
1020  const TypeCode *subType=_type->contentType();
1021  unsigned sizePerContent=subType->getSizeInByteOfAnyReprInSeq();
1022  for(unsigned i=0;i<((const TypeCodeArray *)_type)->getStaticLgth();i++)
1023  subType->putReprAtPlace(data+i*sizePerContent,_data+i*sizePerContent,false);
1024 }
1025 
1026 void ArrayAny::putReprAtPlace(char *data, const char *src, const TypeCodeArray *type, bool deepCpy)
1027 {
1028  const TypeCode *subType=type->contentType();
1029  unsigned sizePerContent=subType->getSizeInByteOfAnyReprInSeq();
1030  for(unsigned i=0;i<type->getStaticLgth();i++)
1031  subType->putReprAtPlace(data+i*sizePerContent,src+i*sizePerContent,deepCpy);
1032 }
1033 
1034 void ArrayAny::destroyReprAtPlace(char *data, const TypeCodeArray *type)
1035 {
1036  const TypeCode *subType=type->contentType();
1037  unsigned sizePerContent=subType->getSizeInByteOfAnyReprInSeq();
1038  for(unsigned i=0;i<type->getStaticLgth();i++)
1039  subType->destroyZippedAny(data+i*sizePerContent);
1040 }
1041 
1043 {
1044  Any *ret;
1045  ret=new ArrayAny(data,(TypeCodeArray *)type);
1046  return AnyPtr(ret);
1047 }
1048 
1050 {
1051  DynType typ=type->kind();
1052  return (typ==Array);
1053 }
1054 
1056 {
1057  return new StructAny(*this);
1058 }
1059 
1060 bool StructAny::operator ==(const Any& other) const
1061 {
1062  if(!_type->isA(other.getType()))
1063  return false;
1064  const TypeCodeStruct *typeC=(const TypeCodeStruct *)_type;
1065  vector< pair<string,TypeCode*> >::const_iterator iter;
1066  for(iter=typeC->_members.begin();iter!=typeC->_members.end();iter++)
1067  if(!((*(*this)[(*iter).first.c_str()]==(*other[(*iter).first.c_str()]))))
1068  return false;
1069  return true;
1070 }
1071 
1073 {
1074  const char what[]="StructAny::operator[](int i) : Struct key are strings not integers.";
1075  throw Exception(what);
1076 }
1077 
1078 AnyPtr StructAny::operator[](const char *key) const
1079 {
1080  const TypeCodeStruct *typeC=(const TypeCodeStruct *)_type;
1081  char *whereToGet=_data;
1082  vector< pair<string,TypeCode*> >::const_iterator iter;
1083  for(iter=typeC->_members.begin();iter!=typeC->_members.end();iter++)
1084  if((*iter).first!=key)
1085  whereToGet+=(*iter).second->getSizeInByteOfAnyReprInSeq();
1086  else
1087  break;
1088  if(iter==typeC->_members.end())
1089  {
1090  string what("Unexisting key \""); what+=key; what+="\" for struct extraction.";
1091  throw Exception(what);
1092  }
1093  return (*iter).second->getOrBuildAnyFromZippedData(whereToGet);
1094 }
1095 
1096 void StructAny::setEltAtRank(int i, const Any *elem)
1097 {
1098  const char what[]="Struct key are strings not integers.";
1099  throw Exception(what);
1100 }
1101 
1102 void StructAny::setEltAtRank(const char *key, const Any *elem)
1103 {
1104  const TypeCodeStruct *typeC=(const TypeCodeStruct *)_type;
1105  unsigned offset;
1106  const TypeCode *tcOnKey=typeC->getMember(key,offset);
1107  if(!tcOnKey)
1108  throw Exception("StructAny::setEltAtRank : invalid key given.");
1109  if(!elem->getType()->isA(tcOnKey))
1110  throw Exception("StructAny::setEltAtRank : invalid data type on the specified given key.");
1111  tcOnKey->destroyZippedAny(_data+offset);
1112  elem->putMyReprAtPlace(_data+offset);
1113 }
1114 
1115 void StructAny::putMyReprAtPlace(char *data) const
1116 {
1117  const TypeCodeStruct *typeC=(const TypeCodeStruct *)_type;
1118  unsigned offset=0;
1119  vector< pair<string,TypeCode*> >::const_iterator iter;
1120  for(iter=typeC->_members.begin();iter!=typeC->_members.end();iter++)
1121  {
1122  (*iter).second->putReprAtPlace(data+offset,_data+offset,false);
1123  offset+=(*iter).second->getSizeInByteOfAnyReprInSeq();
1124  }
1125 }
1126 
1127 void StructAny::putReprAtPlace(char *data, const char *src, const TypeCodeStruct *type, bool deepCpy)
1128 {
1129  unsigned offset=0;
1130  vector< pair<string,TypeCode*> >::const_iterator iter;
1131  for(iter=type->_members.begin();iter!=type->_members.end();iter++)
1132  {
1133  (*iter).second->putReprAtPlace(data+offset,src+offset,deepCpy);
1134  offset+=(*iter).second->getSizeInByteOfAnyReprInSeq();
1135  }
1136 }
1137 
1138 void StructAny::destroyReprAtPlace(char *data, const TypeCodeStruct *type)
1139 {
1140  char *whereToGet=data;
1141  vector< pair<string,TypeCode*> >::const_iterator iter;
1142  for(iter=type->_members.begin();iter!=type->_members.end();iter++)
1143  {
1144  (*iter).second->destroyZippedAny(whereToGet);
1145  whereToGet+=(*iter).second->getSizeInByteOfAnyReprInSeq();
1146  }
1147 }
1148 
1150 {
1151  Any *ret;
1152  ret=new StructAny(data,(TypeCodeStruct *)type);
1153  return AnyPtr(ret);
1154 }
1155 
1157 {
1158  const TypeCodeStruct *typeC=(const TypeCodeStruct *)_type;
1159  vector< pair<string,TypeCode*> >::const_iterator iter;
1160  char *whereToGet=_data;
1161  for(iter=typeC->_members.begin();iter!=typeC->_members.end();iter++)
1162  {
1163  (*iter).second->destroyZippedAny(whereToGet);
1164  whereToGet+=(*iter).second->getSizeInByteOfAnyReprInSeq();
1165  }
1166  delete [] _data;
1167 }
1168 
1170 {
1172  for(unsigned int i=0;i<_type->getSizeInByteOfAnyReprInSeq();i++)
1174 }
1175 
1177 {
1179  const TypeCodeStruct *typeC=(const TypeCodeStruct *)_type;
1180  vector< pair<string,TypeCode*> >::const_iterator iter;
1181  unsigned offset=0;
1182  for(iter=typeC->_members.begin();iter!=typeC->_members.end();iter++)
1183  {
1184  (*iter).second->putReprAtPlace(_data+offset,other._data+offset,true);
1185  offset+=(*iter).second->getSizeInByteOfAnyReprInSeq();
1186  }
1187 }
1188 
1189 StructAny::StructAny(char *data, TypeCodeStruct * type):ComposedAny(type,false),_data(0)
1190 {
1192  vector< pair<string,TypeCode*> >::const_iterator iter;
1193  unsigned offset=0;
1194  for(iter=type->_members.begin();iter!=type->_members.end();iter++)
1195  {
1196  (*iter).second->putReprAtPlace(_data+offset,data+offset,false);
1197  offset+=(*iter).second->getSizeInByteOfAnyReprInSeq();
1198  }
1199 }
1200 
1202 {
1203  return new StructAny(type);
1204 }
char ByteAtPos(const char *chunckPt, std::size_t bytePos)
Definition: Any.cxx:144
unsigned char BitAtPosSimple2(char val, std::size_t bitPos)
Definition: Any.cxx:106
unsigned char CheckEntry(char c)
Definition: Any.cxx:119
unsigned char ChunkInternal(char pt0, char pt1, std::size_t startBitIdInByte)
Definition: Any.cxx:58
unsigned char BitAtPosSimple(char val, std::size_t bitPos)
Definition: Any.cxx:45
char BitAtPosOnChunk(char pt0, char pt1, std::size_t bitPos)
Definition: Any.cxx:111
unsigned char ChunkAtPos(const char *pt, std::size_t len, std::size_t posChunk)
Definition: Any.cxx:70
char ByteInternal(char c0, char c1, std::size_t startBitIdInByte)
Definition: Any.cxx:131
constexpr unsigned char TAB2[MAX_VAL_TAB2]
Definition: Any.cxx:104
constexpr unsigned char TAB[64]
Definition: Any.cxx:43
constexpr unsigned NB_BITS
Definition: Any.cxx:41
unsigned char BitAtPos(char pt0, char pt1, std::size_t bitPos)
Definition: Any.cxx:50
std::size_t OnOff(std::size_t i)
Definition: Any.cxx:78
constexpr unsigned MAX_VAL_TAB2
Definition: Any.cxx:100
constexpr unsigned NOT_OK_VAL
Definition: Any.cxx:102
: Allow to manage memory of instances of T. The only constraint on T is to have method incrRef and De...
Definition: SharedPtr.hxx:30
: Interface for management of storage of data formated dynamically in its TypeCode....
Definition: Any.hxx:79
Any(TypeCode *type)
Definition: Any.cxx:233
friend class SequenceAny
Definition: Any.hxx:83
TypeCode * _type
Definition: Any.hxx:106
friend class StructAny
Definition: Any.hxx:82
virtual void putMyReprAtPlace(char *data) const =0
static bool IsNull(char *data)
Definition: Any.cxx:248
const TypeCode * getType() const
Definition: Any.hxx:85
virtual ~Any()
Definition: Any.cxx:243
friend class ArrayAny
Definition: Any.hxx:81
static AnyPtr getOrBuildFromData(char *data, const TypeCodeArray *type)
Definition: Any.cxx:1042
bool operator==(const Any &other) const
Definition: Any.cxx:983
static void destroyReprAtPlace(char *data, const TypeCodeArray *type)
Definition: Any.cxx:1034
void putMyReprAtPlace(char *data) const
Definition: Any.cxx:1018
AnyPtr operator[](int i) const
Definition: Any.cxx:994
void setEltAtRank(int i, const Any *elem)
Definition: Any.cxx:975
static void putReprAtPlace(char *data, const char *src, const TypeCodeArray *type, bool deepCpy)
Definition: Any.cxx:1026
static ArrayAny * New(const std::vector< T > &vec)
Definition: Any.hxx:324
static bool takeInChargeStorageOf(TypeCode *type)
Definition: Any.cxx:1049
Any * clone() const
Definition: Any.cxx:1008
unsigned int size() const
Definition: Any.cxx:1003
int getIntValue() const
Definition: Any.cxx:366
AnyPtr operator[](int i) const
Definition: Any.cxx:339
static bool takeInChargeStorageOf(TypeCode *type)
Definition: Any.cxx:488
Any * clone() const
Definition: Any.cxx:324
static void putReprAtPlace(char *data, const char *src, const TypeCode *type, bool deepCpy)
Definition: Any.cxx:448
static AnyPtr getOrBuildFromData(char *data, const TypeCode *type)
Definition: Any.cxx:481
bool operator==(const Any &other) const
Definition: Any.cxx:349
ValueContainer _value
Definition: Any.hxx:155
std::string getStringValue() const
Definition: Any.cxx:390
AtomAny(int val)
Definition: Any.cxx:258
double getDoubleValue() const
Definition: Any.cxx:382
static AtomAny * New(T val)
Definition: Any.hxx:126
const char * getBytesValue(std::size_t &len) const
Definition: Any.cxx:404
void putMyReprAtPlace(char *data) const
Definition: Any.cxx:422
static void destroyReprAtPlace(char *data, const TypeCode *type)
Definition: Any.cxx:468
bool getBoolValue() const
Definition: Any.cxx:374
int getIntValue() const
Definition: Any.cxx:521
void checkTypeOf(const Any *elem) const
Definition: Any.cxx:515
AnyPtr operator[](const char *key) const
Definition: Any.cxx:510
bool getBoolValue() const
Definition: Any.cxx:526
double getDoubleValue() const
Definition: Any.cxx:531
ComposedAny(const ComposedAny &other)
Definition: Any.cxx:500
std::string getStringValue() const
Definition: Any.cxx:536
static YACS::ENGINE::TypeCode * _tc_double
Definition: Runtime.hxx:136
static YACS::ENGINE::TypeCode * _tc_bool
Definition: Runtime.hxx:138
static YACS::ENGINE::TypeCode * _tc_int
Definition: Runtime.hxx:137
static YACS::ENGINE::TypeCode * _tc_string
Definition: Runtime.hxx:139
SeqAlloc(const SeqAlloc &other)
Definition: Any.cxx:541
void destroy(char *pt, const TypeCode *tc)
Definition: Any.cxx:633
void construct(char *pt, const Any *val)
Definition: Any.cxx:593
char * _endOfStorage
Definition: Any.hxx:164
const unsigned int _sizeOf1Elm
Definition: Any.hxx:166
void initCoarseMemory(char *mem, unsigned int size, Deallocator dealloc)
Definition: Any.cxx:571
static const char DFT_CHAR_VAR
Definition: Any.hxx:181
char * allocate(unsigned int nbOfByte)
Definition: Any.cxx:610
unsigned int size() const
Definition: Any.cxx:638
Deallocator _notStdDeAlloc
Definition: Any.hxx:165
void deallocate(char *pt)
Definition: Any.cxx:619
std::vector< unsigned int > getSetItems() const
Definition: Any.cxx:643
void setEltAtRank(int i, const Any *elem)
Definition: Any.cxx:696
unsigned int size() const
Definition: Any.hxx:209
AnyPtr operator[](int i) const
Definition: Any.cxx:703
static void putReprAtPlace(char *data, const char *src, const TypeCode *type, bool deepCpy)
Definition: Any.cxx:721
std::vector< unsigned int > getSetItems() const
Definition: Any.hxx:221
SequenceAny * removeUnsetItemsFromThis() const
Definition: Any.cxx:757
bool operator==(const Any &other) const
Definition: Any.cxx:683
void putMyReprAtPlace(char *data) const
Definition: Any.cxx:712
static void destroyReprAtPlace(char *data, const TypeCode *type)
Definition: Any.cxx:737
static bool takeInChargeStorageOf(TypeCode *type)
Definition: Any.cxx:780
void realloc(char *endOfCurrentAllocated, const Any *elem)
Definition: Any.cxx:863
Any * clone() const
Definition: Any.cxx:752
void pushBack(const Any *elem)
Definition: Any.cxx:670
char * performCpy(char *srcStart, char *srcFinish, char *destStart)
Definition: Any.cxx:882
static SequenceAny * New(const std::vector< T > &vec)
Definition: Any.hxx:318
static AnyPtr getOrBuildFromData(char *data, const TypeCode *type)
Definition: Any.cxx:745
std::size_t _len
Definition: Any.hxx:68
StringOnHeap(const char *val)
Definition: Any.cxx:179
StringOnHeap * deepCopy() const
Definition: Any.cxx:217
bool operator==(const StringOnHeap &other) const
Definition: Any.cxx:212
const char * cStr() const
Definition: Any.hxx:63
std::size_t size() const
Definition: Any.hxx:64
Deallocator _dealloc
Definition: Any.hxx:69
static AnyPtr getOrBuildFromData(char *data, const TypeCodeStruct *type)
Definition: Any.cxx:1149
static StructAny * New(TypeCodeStruct *type)
Definition: Any.cxx:1201
AnyPtr operator[](int i) const
Definition: Any.cxx:1072
void putMyReprAtPlace(char *data) const
Definition: Any.cxx:1115
bool operator==(const Any &other) const
Definition: Any.cxx:1060
Any * clone() const
Definition: Any.cxx:1055
static void putReprAtPlace(char *data, const char *src, const TypeCodeStruct *type, bool deepCpy)
Definition: Any.cxx:1127
static void destroyReprAtPlace(char *data, const TypeCodeStruct *type)
Definition: Any.cxx:1138
void setEltAtRank(int i, const Any *elem)
Definition: Any.cxx:1096
Class for array objects.
Definition: TypeCode.hxx:193
virtual const TypeCode * contentType() const
Definition: TypeCode.cxx:581
unsigned getStaticLgth() const
Definition: TypeCode.cxx:576
Class for sequence objects.
Definition: TypeCode.hxx:160
Class for struct type.
Definition: TypeCode.hxx:228
const TypeCode * getMember(const std::string &name, unsigned &offset) const
Get typecode of struct member given its name.
Definition: TypeCode.cxx:801
std::vector< std::pair< std::string, TypeCode * > > _members
Definition: TypeCode.hxx:257
Base class for all type objects.
Definition: TypeCode.hxx:68
virtual void destroyZippedAny(char *data) const
Definition: TypeCode.cxx:62
virtual const TypeCode * contentType() const
Definition: TypeCode.cxx:174
virtual int isA(const char *repositoryId) const
Definition: TypeCode.cxx:99
DynType kind() const
Definition: TypeCode.cxx:47
virtual unsigned getSizeInByteOfAnyReprInSeq() const
Definition: TypeCode.cxx:157
virtual void putReprAtPlace(char *pt, const char *val, bool deepCpy) const
Definition: TypeCode.cxx:57
virtual AnyPtr getOrBuildAnyFromZippedData(char *data) const
Definition: TypeCode.cxx:67
YACSLIBENGINE_EXPORT std::string FromBase64Safe(const std::string &bytes)
Definition: Any.cxx:167
SharedPtr< Any > AnyPtr
Definition: Any.hxx:72
void(* Deallocator)(void *)
Definition: Any.hxx:43
YACSLIBENGINE_EXPORT std::string ToBase64(const std::string &bytes)
Definition: Any.cxx:85
YACSLIBENGINE_EXPORT std::string FromBase64(const std::string &bytes)
Definition: Any.cxx:151