Pol  Revision:3cfda13
bobject.h
Go to the documentation of this file.
1 
9 #ifndef BSCRIPT_BOBJECT_H
10 #define BSCRIPT_BOBJECT_H
11 
12 #ifdef NDEBUG
13 #define BOBJECTIMP_DEBUG 0
14 #else
15 #define BOBJECTIMP_DEBUG 1
16 #endif
17 
18 #if BOBJECTIMP_DEBUG
19 #define INLINE_BOBJECTIMP_CTOR 0
20 #else
21 #define INLINE_BOBJECTIMP_CTOR 1
22 #endif
23 
24 #include <format/format.h>
25 
26 #include "../clib/fixalloc.h"
27 #include "../clib/passert.h"
28 #include "../clib/rawtypes.h"
29 #include "../clib/refptr.h"
30 #include "../clib/spinlock.h"
31 
32 #if INLINE_BOBJECTIMP_CTOR
33 #include "escriptv.h"
34 #endif
35 
36 #include <iosfwd>
37 #include <stack>
38 #include <vector>
39 
40 namespace Pol
41 {
45 namespace Bscript
46 {
47 class BObjectImp;
48 class BObject;
49 class BObjectRef;
50 class ContIterator;
51 class Executor;
52 class Instruction;
53 
54 class BLong;
55 class Double;
56 class String;
57 class ObjArray;
58 
59 class BObjectImp : public ref_counted
60 {
61 public:
70  enum BObjectType : u8
71  {
72  OTUnknown = 0,
73  OTUninit = 1,
74  OTString = 2,
75  OTLong = 3,
76  OTDouble = 4,
77  OTArray = 5,
80  OTError = 8,
82  OTStruct = 10,
83  OTPacket = 11,
85  OTXMLFile = 13,
86  OTXMLNode = 14,
89 
90  // non direct used constants (for TypeOfInt) start
96  OTGuildRef = 22,
97  OTPartyRef = 23,
101  OTPackage = 27,
102  OTMenuRef = 28,
105  OTItemRef = 31,
106  OTBoatRef = 32,
109  // non direct used Constants (for TypeOfInt) end
110 
113  OTSQLRow = 37,
114  OTBoolean = 38,
115  OTFuncRef = 39,
116  };
117 
118 #if INLINE_BOBJECTIMP_CTOR
119  explicit BObjectImp( BObjectType type ) : type_( type )
120  {
123  }
124  virtual ~BObjectImp() { --eobject_imp_count; }
125 #else
126  explicit BObjectImp( BObjectType type );
127  virtual ~BObjectImp();
128 #endif
129 
130 
131  // Class Machinery:
132  static BObjectImp* unpack( const char* pstr );
133  static BObjectImp* unpack( std::istream& is );
134  bool isa( BObjectType type ) const;
135  BObjectType type() const;
136 #if BOBJECTIMP_DEBUG
137  unsigned int instance() const { return instance_; }
138 #endif
139  static const char* typestr( BObjectType typ );
140 
141  virtual BObjectImp* copy() const = 0;
142  virtual std::string getStringRep() const = 0;
143  virtual std::string getFormattedStringRep() const;
144 
145  virtual size_t sizeEstimate() const = 0;
146  virtual const char* typeOf() const;
147  virtual u8 typeOfInt() const;
148 
149 
150  virtual std::string pack() const;
151  virtual void packonto( std::ostream& os ) const;
152  virtual void printOn( std::ostream& ) const;
153 
154  virtual bool operator==( const BObjectImp& objimp ) const;
155  virtual bool operator<( const BObjectImp& objimp ) const;
156  virtual bool operator<=( const BObjectImp& objimp ) const;
157  virtual bool operator>( const BObjectImp& objimp ) const;
158  virtual bool operator>=( const BObjectImp& objimp ) const;
159  virtual bool operator!=( const BObjectImp& objimp ) const;
160 
161  virtual BObjectImp* selfPlusObjImp( const BObjectImp& objimp ) const;
162  virtual BObjectImp* selfPlusObj( const BObjectImp& objimp ) const;
163  virtual BObjectImp* selfPlusObj( const BLong& objimp ) const;
164  virtual BObjectImp* selfPlusObj( const Double& objimp ) const;
165  virtual BObjectImp* selfPlusObj( const String& objimp ) const;
166  virtual BObjectImp* selfPlusObj( const ObjArray& objimp ) const;
167  virtual void selfPlusObjImp( BObjectImp& objimp, BObject& obj );
168  virtual void selfPlusObj( BObjectImp& objimp, BObject& obj );
169  virtual void selfPlusObj( BLong& objimp, BObject& obj );
170  virtual void selfPlusObj( Double& objimp, BObject& obj );
171  virtual void selfPlusObj( String& objimp, BObject& obj );
172  virtual void selfPlusObj( ObjArray& objimp, BObject& obj );
173 
174  virtual BObjectImp* selfMinusObjImp( const BObjectImp& objimp ) const;
175  virtual BObjectImp* selfMinusObj( const BObjectImp& objimp ) const;
176  virtual BObjectImp* selfMinusObj( const BLong& objimp ) const;
177  virtual BObjectImp* selfMinusObj( const Double& objimp ) const;
178  virtual BObjectImp* selfMinusObj( const String& objimp ) const;
179  virtual BObjectImp* selfMinusObj( const ObjArray& objimp ) const;
180  virtual void selfMinusObjImp( BObjectImp& objimp, BObject& obj );
181  virtual void selfMinusObj( BObjectImp& objimp, BObject& obj );
182  virtual void selfMinusObj( BLong& objimp, BObject& obj );
183  virtual void selfMinusObj( Double& objimp, BObject& obj );
184  virtual void selfMinusObj( String& objimp, BObject& obj );
185  virtual void selfMinusObj( ObjArray& objimp, BObject& obj );
186 
187  virtual BObjectImp* selfTimesObjImp( const BObjectImp& objimp ) const;
188  virtual BObjectImp* selfTimesObj( const BObjectImp& objimp ) const;
189  virtual BObjectImp* selfTimesObj( const BLong& objimp ) const;
190  virtual BObjectImp* selfTimesObj( const Double& objimp ) const;
191  virtual BObjectImp* selfTimesObj( const String& objimp ) const;
192  virtual BObjectImp* selfTimesObj( const ObjArray& objimp ) const;
193  virtual void selfTimesObjImp( BObjectImp& objimp, BObject& obj );
194  virtual void selfTimesObj( BObjectImp& objimp, BObject& obj );
195  virtual void selfTimesObj( BLong& objimp, BObject& obj );
196  virtual void selfTimesObj( Double& objimp, BObject& obj );
197  virtual void selfTimesObj( String& objimp, BObject& obj );
198  virtual void selfTimesObj( ObjArray& objimp, BObject& obj );
199 
200  virtual BObjectImp* selfDividedByObjImp( const BObjectImp& objimp ) const;
201  virtual BObjectImp* selfDividedByObj( const BObjectImp& objimp ) const;
202  virtual BObjectImp* selfDividedByObj( const BLong& objimp ) const;
203  virtual BObjectImp* selfDividedByObj( const Double& objimp ) const;
204  virtual BObjectImp* selfDividedByObj( const String& objimp ) const;
205  virtual BObjectImp* selfDividedByObj( const ObjArray& objimp ) const;
206  virtual void selfDividedByObjImp( BObjectImp& objimp, BObject& obj );
207  virtual void selfDividedByObj( BObjectImp& objimp, BObject& obj );
208  virtual void selfDividedByObj( BLong& objimp, BObject& obj );
209  virtual void selfDividedByObj( Double& objimp, BObject& obj );
210  virtual void selfDividedByObj( String& objimp, BObject& obj );
211  virtual void selfDividedByObj( ObjArray& objimp, BObject& obj );
212 
213  virtual BObjectImp* selfModulusObjImp( const BObjectImp& objimp ) const;
214  virtual BObjectImp* selfModulusObj( const BObjectImp& objimp ) const;
215  virtual BObjectImp* selfModulusObj( const BLong& objimp ) const;
216  virtual BObjectImp* selfModulusObj( const Double& objimp ) const;
217  virtual BObjectImp* selfModulusObj( const String& objimp ) const;
218  virtual BObjectImp* selfModulusObj( const ObjArray& objimp ) const;
219  virtual void selfModulusObjImp( BObjectImp& objimp, BObject& obj );
220  virtual void selfModulusObj( BObjectImp& objimp, BObject& obj );
221  virtual void selfModulusObj( BLong& objimp, BObject& obj );
222  virtual void selfModulusObj( Double& objimp, BObject& obj );
223  virtual void selfModulusObj( String& objimp, BObject& obj );
224  virtual void selfModulusObj( ObjArray& objimp, BObject& obj );
225 
226  virtual BObjectImp* selfBitShiftRightObjImp( const BObjectImp& objimp ) const;
227  virtual BObjectImp* selfBitShiftRightObj( const BObjectImp& objimp ) const;
228  virtual BObjectImp* selfBitShiftRightObj( const BLong& objimp ) const;
229  virtual BObjectImp* selfBitShiftRightObj( const Double& objimp ) const;
230  virtual BObjectImp* selfBitShiftRightObj( const String& objimp ) const;
231  virtual BObjectImp* selfBitShiftRightObj( const ObjArray& objimp ) const;
232  virtual void selfBitShiftRightObjImp( BObjectImp& objimp, BObject& obj );
233  virtual void selfBitShiftRightObj( BObjectImp& objimp, BObject& obj );
234  virtual void selfBitShiftRightObj( BLong& objimp, BObject& obj );
235  virtual void selfBitShiftRightObj( Double& objimp, BObject& obj );
236  virtual void selfBitShiftRightObj( String& objimp, BObject& obj );
237  virtual void selfBitShiftRightObj( ObjArray& objimp, BObject& obj );
238 
239  virtual BObjectImp* selfBitShiftLeftObjImp( const BObjectImp& objimp ) const;
240  virtual BObjectImp* selfBitShiftLeftObj( const BObjectImp& objimp ) const;
241  virtual BObjectImp* selfBitShiftLeftObj( const BLong& objimp ) const;
242  virtual BObjectImp* selfBitShiftLeftObj( const Double& objimp ) const;
243  virtual BObjectImp* selfBitShiftLeftObj( const String& objimp ) const;
244  virtual BObjectImp* selfBitShiftLeftObj( const ObjArray& objimp ) const;
245  virtual void selfBitShiftLeftObjImp( BObjectImp& objimp, BObject& obj );
246  virtual void selfBitShiftLeftObj( BObjectImp& objimp, BObject& obj );
247  virtual void selfBitShiftLeftObj( BLong& objimp, BObject& obj );
248  virtual void selfBitShiftLeftObj( Double& objimp, BObject& obj );
249  virtual void selfBitShiftLeftObj( String& objimp, BObject& obj );
250  virtual void selfBitShiftLeftObj( ObjArray& objimp, BObject& obj );
251 
252  virtual BObjectImp* selfBitAndObjImp( const BObjectImp& objimp ) const;
253  virtual BObjectImp* selfBitAndObj( const BObjectImp& objimp ) const;
254  virtual BObjectImp* selfBitAndObj( const BLong& objimp ) const;
255  virtual BObjectImp* selfBitAndObj( const Double& objimp ) const;
256  virtual BObjectImp* selfBitAndObj( const String& objimp ) const;
257  virtual BObjectImp* selfBitAndObj( const ObjArray& objimp ) const;
258  virtual void selfBitAndObjImp( BObjectImp& objimp, BObject& obj );
259  virtual void selfBitAndObj( BObjectImp& objimp, BObject& obj );
260  virtual void selfBitAndObj( BLong& objimp, BObject& obj );
261  virtual void selfBitAndObj( Double& objimp, BObject& obj );
262  virtual void selfBitAndObj( String& objimp, BObject& obj );
263  virtual void selfBitAndObj( ObjArray& objimp, BObject& obj );
264 
265  virtual BObjectImp* selfBitXorObjImp( const BObjectImp& objimp ) const;
266  virtual BObjectImp* selfBitXorObj( const BObjectImp& objimp ) const;
267  virtual BObjectImp* selfBitXorObj( const BLong& objimp ) const;
268  virtual BObjectImp* selfBitXorObj( const Double& objimp ) const;
269  virtual BObjectImp* selfBitXorObj( const String& objimp ) const;
270  virtual BObjectImp* selfBitXorObj( const ObjArray& objimp ) const;
271  virtual void selfBitXorObjImp( BObjectImp& objimp, BObject& obj );
272  virtual void selfBitXorObj( BObjectImp& objimp, BObject& obj );
273  virtual void selfBitXorObj( BLong& objimp, BObject& obj );
274  virtual void selfBitXorObj( Double& objimp, BObject& obj );
275  virtual void selfBitXorObj( String& objimp, BObject& obj );
276  virtual void selfBitXorObj( ObjArray& objimp, BObject& obj );
277 
278  virtual BObjectImp* selfBitOrObjImp( const BObjectImp& objimp ) const;
279  virtual BObjectImp* selfBitOrObj( const BObjectImp& objimp ) const;
280  virtual BObjectImp* selfBitOrObj( const BLong& objimp ) const;
281  virtual BObjectImp* selfBitOrObj( const Double& objimp ) const;
282  virtual BObjectImp* selfBitOrObj( const String& objimp ) const;
283  virtual BObjectImp* selfBitOrObj( const ObjArray& objimp ) const;
284  virtual void selfBitOrObjImp( BObjectImp& objimp, BObject& obj );
285  virtual void selfBitOrObj( BObjectImp& objimp, BObject& obj );
286  virtual void selfBitOrObj( BLong& objimp, BObject& obj );
287  virtual void selfBitOrObj( Double& objimp, BObject& obj );
288  virtual void selfBitOrObj( String& objimp, BObject& obj );
289  virtual void selfBitOrObj( ObjArray& objimp, BObject& obj );
290 
291  virtual BObjectImp* bitnot() const;
292 
293  virtual BObjectRef operDotPlus( const char* name );
294  virtual BObjectRef operDotMinus( const char* name );
295  virtual BObjectRef operDotQMark( const char* name );
296 
297  virtual void operInsertInto( BObject& obj, const BObjectImp& objimp );
298 
299  virtual void operPlusEqual( BObject& obj, BObjectImp& objimp );
300  virtual void operMinusEqual( BObject& obj, BObjectImp& objimp );
301  virtual void operTimesEqual( BObject& obj, BObjectImp& objimp );
302  virtual void operDivideEqual( BObject& obj, BObjectImp& objimp );
303  virtual void operModulusEqual( BObject& obj, BObjectImp& objimp );
304 
305  virtual BObject operator-() const;
306 
307  virtual char /*BObjectRef */ member( const BObject& obj ) const;
308  virtual char /*BObjectImp* */ str_member( const std::string& membername ) const;
309 
310  virtual BObjectImp* call_method( const char* methodname, Executor& ex );
311  virtual BObjectImp* call_method_id( const int id, Executor& ex, bool forcebuiltin = false );
312  virtual BObjectRef set_member( const char* membername, BObjectImp* valueimp, bool copy );
313  virtual BObjectRef get_member( const char* membername );
314  virtual BObjectRef get_member_id( const int id ); // test id
315  virtual BObjectRef set_member_id( const int id, BObjectImp* valueimp, bool copy ); // test id
316 
317  virtual BObjectRef OperSubscript( const BObject& obj );
318  virtual BObjectRef OperMultiSubscript( std::stack<BObjectRef>& indices );
319  virtual BObjectRef OperMultiSubscriptAssign( std::stack<BObjectRef>& indices,
320  BObjectImp* target );
321 
322  virtual bool isTrue() const;
323  virtual long contains( const BObjectImp& objimp ) const;
324 
325  virtual BObjectImp* array_assign( BObjectImp* idx, BObjectImp* target, bool copy );
326 
327  virtual BObjectImp* inverse() const;
328 
329  virtual ContIterator* createIterator( BObject* pIterVal );
330 
331  friend std::ostream& operator<<( std::ostream&, const BObjectImp& );
332  friend fmt::Writer& operator<<( fmt::Writer&, const BObjectImp& );
333 
334 private:
336 #if BOBJECTIMP_DEBUG
337  unsigned int instance_;
338  static unsigned int instances_;
340 #endif
341 };
342 
343 inline char /*BObjectRef */ BObjectImp::member( const BObject& ) const
344 {
345  return 0;
346 }
347 inline char /*BObjectImp* */ BObjectImp::str_member( const std::string& ) const
348 {
349  return 0;
350 }
351 
352 
353 inline bool BObjectImp::isa( BObjectType type ) const
354 {
355  return ( type == type_ );
356 }
357 
359 {
360  return type_;
361 }
362 
363 class BObject : public ref_counted
364 {
365 public:
366  explicit BObject( BObjectImp* objimp ) : ref_counted(), objimp( objimp ) { passert( objimp ); }
367  BObject( const BObject& obj ) : ref_counted(), objimp( obj.objimp ) {}
368  ~BObject();
369  // NOTE: BObject should not be derived from!
370 
371  size_t sizeEstimate() const;
372 
373  void* operator new( std::size_t len );
374  void operator delete( void* );
375 
376  bool operator!=( const BObject& obj ) const;
377  bool operator==( const BObject& obj ) const;
378  bool operator<( const BObject& obj ) const;
379  bool operator<=( const BObject& obj ) const;
380  bool operator>( const BObject& obj ) const;
381  bool operator>=( const BObject& obj ) const;
382 
383  BObjectImp* operator->() const { return objimp.get(); }
384  bool isTrue() const { return objimp->isTrue(); }
385  void assign( const BObjectImp& objimp );
386 
387  BObject* clone() const;
388 
389  bool isa( BObjectImp::BObjectType type ) const;
390 
391  // friend StreamWriter& operator << (StreamWriter&, const BObject& );
392  friend std::ostream& operator<<( std::ostream&, const BObject& );
393  friend fmt::Writer& operator<<( fmt::Writer&, const BObject& );
394  void printOn( std::ostream& ) const;
395 
396  BObjectImp* impptr();
397  const BObjectImp* impptr() const;
398  BObjectImp& impref();
399  const BObjectImp& impref() const;
400 
401  void setimp( BObjectImp* imp );
402 
403 private:
405 
406  BObject& operator=( const BObject& obj );
407 };
408 
409 typedef std::vector<ref_ptr<BObjectImp>> BObjectImpRefVec;
410 
412 
413 inline void* BObject::operator new( std::size_t /*len*/ )
414 {
415  return bobject_alloc.allocate();
416 }
417 
418 inline void BObject::operator delete( void* p )
419 {
420  bobject_alloc.deallocate( p );
421 }
422 
424 {
425  return objimp->isa( type );
426 }
427 
429 {
430  return objimp.get();
431 }
432 
433 inline const BObjectImp* BObject::impptr() const
434 {
435  return objimp.get();
436 }
437 
439 {
440  return *objimp;
441 }
442 inline const BObjectImp& BObject::impref() const
443 {
444  return *objimp;
445 }
446 inline void BObject::setimp( BObjectImp* imp )
447 {
448  objimp.set( imp );
449 }
450 
451 class BObjectRef : public ref_ptr<BObject>
452 {
453 public:
454  explicit BObjectRef( BObject* pobj = NULL ) : ref_ptr<BObject>( pobj ) {}
455  explicit BObjectRef( BObjectImp* pimp ) : ref_ptr<BObject>( new BObject( pimp ) ) {}
456  void set( BObject* obj ) { ref_ptr<BObject>::set( obj ); }
457  size_t sizeEstimate() const;
458 };
459 
460 
461 class UninitObject : public BObjectImp
462 {
463 public:
464  UninitObject();
465  UninitObject( const UninitObject& i );
466 
469 
470  virtual BObjectImp* copy() const POL_OVERRIDE;
471  virtual size_t sizeEstimate() const POL_OVERRIDE;
472  virtual std::string getStringRep() const POL_OVERRIDE { return "<uninitialized object>"; }
473  virtual void printOn( std::ostream& os ) const POL_OVERRIDE;
474 
475  virtual bool isTrue() const POL_OVERRIDE;
476  virtual bool operator==( const BObjectImp& objimp ) const POL_OVERRIDE;
477  virtual bool operator<( const BObjectImp& objimp ) const POL_OVERRIDE;
478 
479  void* operator new( std::size_t len );
480  void operator delete( void* );
481 
482  static UninitObject* create() { return SharedInstance; }
483  static void ReleaseSharedInstance()
484  {
485  SharedInstanceOwner.clear();
486  SharedInstance = NULL;
487  }
488 };
490 
491 inline void* UninitObject::operator new( std::size_t /*len*/ )
492 {
493  return uninit_alloc.allocate();
494 }
495 
496 inline void UninitObject::operator delete( void* p )
497 {
498  uninit_alloc.deallocate( p );
499 }
500 class ObjArray : public BObjectImp
501 {
502 public:
503  typedef std::vector<std::string> NameCont;
504  typedef NameCont::iterator name_iterator;
505  typedef NameCont::const_iterator const_name_iterator;
506 
507  typedef std::vector<BObjectRef> Cont;
508  typedef Cont::iterator iterator;
509  typedef Cont::const_iterator const_iterator;
510 
511  NameCont name_arr;
512  Cont ref_arr;
513 
514  ObjArray();
515  ObjArray( const ObjArray& i ); // copy constructor
516 
517  virtual void packonto( std::ostream& os ) const POL_OVERRIDE;
518  static BObjectImp* unpack( std::istream& is );
519  virtual size_t sizeEstimate() const POL_OVERRIDE;
520  virtual BObjectImp* copy() const POL_OVERRIDE;
521 
522  virtual BObjectRef operDotPlus( const char* name ) POL_OVERRIDE;
523  virtual long contains( const BObjectImp& imp ) const POL_OVERRIDE;
524  virtual void operInsertInto( BObject& obj, const BObjectImp& objimp ) POL_OVERRIDE;
525  virtual BObjectImp* selfPlusObjImp( const BObjectImp& other ) const POL_OVERRIDE;
526  virtual BObjectImp* selfPlusObj( const BObjectImp& objimp ) const POL_OVERRIDE;
527  virtual BObjectImp* selfPlusObj( const BLong& objimp ) const POL_OVERRIDE;
528  virtual BObjectImp* selfPlusObj( const Double& objimp ) const POL_OVERRIDE;
529  virtual BObjectImp* selfPlusObj( const String& objimp ) const POL_OVERRIDE;
530  virtual BObjectImp* selfPlusObj( const ObjArray& objimp ) const POL_OVERRIDE;
531  virtual void selfPlusObjImp( BObjectImp& objimp, BObject& obj ) POL_OVERRIDE;
532  virtual void selfPlusObj( BObjectImp& objimp, BObject& obj ) POL_OVERRIDE;
533  virtual void selfPlusObj( BLong& objimp, BObject& obj ) POL_OVERRIDE;
534  virtual void selfPlusObj( Double& objimp, BObject& obj ) POL_OVERRIDE;
535  virtual void selfPlusObj( String& objimp, BObject& obj ) POL_OVERRIDE;
536  virtual void selfPlusObj( ObjArray& objimp, BObject& obj ) POL_OVERRIDE;
537 
538  virtual BObjectImp* call_method( const char* methodname, Executor& ex ) POL_OVERRIDE;
539  virtual BObjectImp* call_method_id( const int id, Executor& ex,
540  bool forcebuiltin = false ) POL_OVERRIDE;
541  virtual BObjectRef set_member( const char* membername, BObjectImp* value,
542  bool copy ) POL_OVERRIDE;
543  virtual BObjectRef get_member( const char* membername ) POL_OVERRIDE;
544 
545  void addElement( BObjectImp* imp );
546 
547  const BObjectImp* imp_at( unsigned index ) const; // 1-based
548 
549  virtual std::string getStringRep() const POL_OVERRIDE;
550  virtual void printOn( std::ostream& os ) const POL_OVERRIDE;
551 
552  virtual BObjectImp* array_assign( BObjectImp* idx, BObjectImp* target, bool copy ) POL_OVERRIDE;
553  virtual BObjectRef OperSubscript( const BObject& obj ) POL_OVERRIDE;
554  virtual BObjectRef OperMultiSubscript( std::stack<BObjectRef>& indices ) POL_OVERRIDE;
555 
556  virtual bool operator==( const BObjectImp& objimp ) const POL_OVERRIDE;
557 
558  virtual ContIterator* createIterator( BObject* pIterVal ) POL_OVERRIDE;
559 
560 protected:
561  explicit ObjArray( BObjectType type );
562  void deepcopy();
563 };
564 
565 class BLong : public BObjectImp
566 {
567  typedef BObjectImp base;
568 
569 public:
570 #if BOBJECTIMP_DEBUG
571  explicit BLong( int lval = 0L );
572  BLong( const BLong& L );
573 #else
574  explicit BLong( int lval = 0L ) : BObjectImp( OTLong ), lval_( static_cast<int>( lval ) ) {}
575  BLong( const BLong& L ) : BObjectImp( OTLong ), lval_( L.lval_ ) {}
576 #endif
577 private:
578  ~BLong() {}
579 
580 public:
581  void* operator new( std::size_t len );
582  void operator delete( void* );
583  void operator delete( void*, size_t );
584 
585  static BObjectImp* unpack( const char* pstr );
586  static BObjectImp* unpack( std::istream& is );
587  virtual std::string pack() const POL_OVERRIDE;
588  static std::string pack( int val );
589  virtual void packonto( std::ostream& os ) const POL_OVERRIDE;
590  virtual size_t sizeEstimate() const POL_OVERRIDE;
591 
592  int value() const { return lval_; }
593  int increment() { return ++lval_; }
594 
595 public: // Class Machinery
596  virtual BObjectImp* copy() const POL_OVERRIDE;
597  virtual BObjectImp* inverse() const POL_OVERRIDE { return new BLong( -lval_ ); }
598  void copyvalue( const BLong& ni ) { lval_ = ni.lval_; }
599  virtual bool isTrue() const POL_OVERRIDE;
600  virtual bool operator==( const BObjectImp& objimp ) const POL_OVERRIDE;
601  virtual bool operator<( const BObjectImp& objimp ) const POL_OVERRIDE;
602 
603  virtual BObjectImp* selfPlusObjImp( const BObjectImp& objimp ) const POL_OVERRIDE;
604  virtual BObjectImp* selfPlusObj( const BLong& objimp ) const POL_OVERRIDE;
605  virtual BObjectImp* selfPlusObj( const Double& objimp ) const POL_OVERRIDE;
606  virtual BObjectImp* selfPlusObj( const String& objimp ) const POL_OVERRIDE;
607  virtual void selfPlusObjImp( BObjectImp& objimp, BObject& obj ) POL_OVERRIDE;
608  virtual void selfPlusObj( BLong& objimp, BObject& obj ) POL_OVERRIDE;
609  virtual void selfPlusObj( Double& objimp, BObject& obj ) POL_OVERRIDE;
610  virtual void selfPlusObj( String& objimp, BObject& obj ) POL_OVERRIDE;
611 
612  virtual BObjectImp* selfMinusObjImp( const BObjectImp& objimp ) const POL_OVERRIDE;
613  virtual BObjectImp* selfMinusObj( const BLong& objimp ) const POL_OVERRIDE;
614  virtual BObjectImp* selfMinusObj( const Double& objimp ) const POL_OVERRIDE;
615  virtual BObjectImp* selfMinusObj( const String& objimp ) const POL_OVERRIDE;
616  virtual void selfMinusObjImp( BObjectImp& objimp, BObject& obj ) POL_OVERRIDE;
617  virtual void selfMinusObj( BLong& objimp, BObject& obj ) POL_OVERRIDE;
618  virtual void selfMinusObj( Double& objimp, BObject& obj ) POL_OVERRIDE;
619  virtual void selfMinusObj( String& objimp, BObject& obj ) POL_OVERRIDE;
620 
621  virtual BObjectImp* selfTimesObjImp( const BObjectImp& objimp ) const POL_OVERRIDE;
622  virtual BObjectImp* selfTimesObj( const BLong& objimp ) const POL_OVERRIDE;
623  virtual BObjectImp* selfTimesObj( const Double& objimp ) const POL_OVERRIDE;
624  virtual void selfTimesObjImp( BObjectImp& objimp, BObject& obj ) POL_OVERRIDE;
625  virtual void selfTimesObj( BLong& objimp, BObject& obj ) POL_OVERRIDE;
626  virtual void selfTimesObj( Double& objimp, BObject& obj ) POL_OVERRIDE;
627 
628  virtual BObjectImp* selfDividedByObjImp( const BObjectImp& objimp ) const POL_OVERRIDE;
629  virtual BObjectImp* selfDividedByObj( const BLong& objimp ) const POL_OVERRIDE;
630  virtual BObjectImp* selfDividedByObj( const Double& objimp ) const POL_OVERRIDE;
631  virtual void selfDividedByObjImp( BObjectImp& objimp, BObject& obj ) POL_OVERRIDE;
632  virtual void selfDividedByObj( BLong& objimp, BObject& obj ) POL_OVERRIDE;
633  virtual void selfDividedByObj( Double& objimp, BObject& obj ) POL_OVERRIDE;
634 
635  virtual BObjectImp* selfModulusObjImp( const BObjectImp& objimp ) const POL_OVERRIDE;
636  virtual BObjectImp* selfModulusObj( const BLong& objimp ) const POL_OVERRIDE;
637  virtual BObjectImp* selfModulusObj( const Double& objimp ) const POL_OVERRIDE;
638  virtual void selfModulusObjImp( BObjectImp& objimp, BObject& obj ) POL_OVERRIDE;
639  virtual void selfModulusObj( BLong& objimp, BObject& obj ) POL_OVERRIDE;
640  virtual void selfModulusObj( Double& objimp, BObject& obj ) POL_OVERRIDE;
641 
642  virtual BObjectImp* selfBitShiftRightObjImp( const BObjectImp& objimp ) const POL_OVERRIDE;
643  virtual BObjectImp* selfBitShiftRightObj( const BLong& objimp ) const POL_OVERRIDE;
644  virtual void selfBitShiftRightObjImp( BObjectImp& objimp, BObject& obj ) POL_OVERRIDE;
645  virtual void selfBitShiftRightObj( BLong& objimp, BObject& obj ) POL_OVERRIDE;
646 
647  virtual BObjectImp* selfBitShiftLeftObjImp( const BObjectImp& objimp ) const POL_OVERRIDE;
648  virtual BObjectImp* selfBitShiftLeftObj( const BLong& objimp ) const POL_OVERRIDE;
649  virtual void selfBitShiftLeftObjImp( BObjectImp& objimp, BObject& obj ) POL_OVERRIDE;
650  virtual void selfBitShiftLeftObj( BLong& objimp, BObject& obj ) POL_OVERRIDE;
651 
652  virtual BObjectImp* selfBitAndObjImp( const BObjectImp& objimp ) const POL_OVERRIDE;
653  virtual BObjectImp* selfBitAndObj( const BLong& objimp ) const POL_OVERRIDE;
654  virtual void selfBitAndObjImp( BObjectImp& objimp, BObject& obj ) POL_OVERRIDE;
655  virtual void selfBitAndObj( BLong& objimp, BObject& obj ) POL_OVERRIDE;
656 
657  virtual BObjectImp* selfBitXorObjImp( const BObjectImp& objimp ) const POL_OVERRIDE;
658  virtual BObjectImp* selfBitXorObj( const BLong& objimp ) const POL_OVERRIDE;
659  virtual void selfBitXorObjImp( BObjectImp& objimp, BObject& obj ) POL_OVERRIDE;
660  virtual void selfBitXorObj( BLong& objimp, BObject& obj ) POL_OVERRIDE;
661 
662  virtual BObjectImp* selfBitOrObjImp( const BObjectImp& objimp ) const POL_OVERRIDE;
663  virtual BObjectImp* selfBitOrObj( const BLong& objimp ) const POL_OVERRIDE;
664  virtual void selfBitOrObjImp( BObjectImp& objimp, BObject& obj ) POL_OVERRIDE;
665  virtual void selfBitOrObj( BLong& objimp, BObject& obj ) POL_OVERRIDE;
666 
667  virtual BObjectImp* bitnot() const POL_OVERRIDE;
668 
669  virtual std::string getStringRep() const POL_OVERRIDE;
670  virtual void printOn( std::ostream& ) const POL_OVERRIDE;
671 
672 protected:
673  int lval_;
674 };
675 
677 inline void* BLong::operator new( std::size_t len )
678 {
679  (void)len;
680  passert_paranoid( len == sizeof( BLong ) );
681  return blong_alloc.allocate();
682 }
683 inline void BLong::operator delete( void* p )
684 {
685  blong_alloc.deallocate( p );
686 }
687 inline void BLong::operator delete( void* p, size_t /*len*/ )
688 {
689  blong_alloc.deallocate( p );
690 }
691 
692 class Double : public BObjectImp
693 {
694  typedef BObjectImp base;
695 
696 public:
697  explicit Double( double dval = 0.0 ) : BObjectImp( OTDouble ), dval_( dval ) {}
698  Double( const Double& dbl ) : BObjectImp( OTDouble ), dval_( dbl.dval_ ) {}
699 
700 protected:
701  ~Double() {}
702 
703 public:
704  void* operator new( std::size_t len );
705  void operator delete( void* );
706 
707  static BObjectImp* unpack( const char* pstr );
708  static BObjectImp* unpack( std::istream& is );
709  virtual std::string pack() const POL_OVERRIDE;
710  virtual void packonto( std::ostream& os ) const POL_OVERRIDE;
711  virtual size_t sizeEstimate() const POL_OVERRIDE;
712 
713  double value() const { return dval_; }
714  void copyvalue( const Double& dbl ) { dval_ = dbl.dval_; }
715  double increment() { return ++dval_; }
716 
717 public: // Class Machinery
718  virtual bool isTrue() const POL_OVERRIDE { return ( dval_ != 0.0 ); }
719  virtual BObjectImp* copy() const POL_OVERRIDE { return new Double( *this ); }
720  virtual bool operator==( const BObjectImp& objimp ) const POL_OVERRIDE;
721  virtual bool operator<( const BObjectImp& objimp ) const POL_OVERRIDE;
722 
723  virtual BObjectImp* selfPlusObjImp( const BObjectImp& objimp ) const POL_OVERRIDE;
724  virtual BObjectImp* selfPlusObj( const BLong& objimp ) const POL_OVERRIDE;
725  virtual BObjectImp* selfPlusObj( const Double& objimp ) const POL_OVERRIDE;
726  virtual BObjectImp* selfPlusObj( const String& objimp ) const POL_OVERRIDE;
727  virtual void selfPlusObjImp( BObjectImp& objimp, BObject& obj ) POL_OVERRIDE;
728  virtual void selfPlusObj( BLong& objimp, BObject& obj ) POL_OVERRIDE;
729  virtual void selfPlusObj( Double& objimp, BObject& obj ) POL_OVERRIDE;
730  virtual void selfPlusObj( String& objimp, BObject& obj ) POL_OVERRIDE;
731 
732  virtual BObjectImp* selfMinusObjImp( const BObjectImp& objimp ) const POL_OVERRIDE;
733  virtual BObjectImp* selfMinusObj( const BLong& objimp ) const POL_OVERRIDE;
734  virtual BObjectImp* selfMinusObj( const Double& objimp ) const POL_OVERRIDE;
735  virtual BObjectImp* selfMinusObj( const String& objimp ) const POL_OVERRIDE;
736  virtual void selfMinusObjImp( BObjectImp& objimp, BObject& obj ) POL_OVERRIDE;
737  virtual void selfMinusObj( BLong& objimp, BObject& obj ) POL_OVERRIDE;
738  virtual void selfMinusObj( Double& objimp, BObject& obj ) POL_OVERRIDE;
739  virtual void selfMinusObj( String& objimp, BObject& obj ) POL_OVERRIDE;
740 
741  virtual BObjectImp* selfTimesObjImp( const BObjectImp& objimp ) const POL_OVERRIDE;
742  virtual BObjectImp* selfTimesObj( const BLong& objimp ) const POL_OVERRIDE;
743  virtual BObjectImp* selfTimesObj( const Double& objimp ) const POL_OVERRIDE;
744  virtual void selfTimesObjImp( BObjectImp& objimp, BObject& obj ) POL_OVERRIDE;
745  virtual void selfTimesObj( BLong& objimp, BObject& obj ) POL_OVERRIDE;
746  virtual void selfTimesObj( Double& objimp, BObject& obj ) POL_OVERRIDE;
747 
748  virtual BObjectImp* selfDividedByObjImp( const BObjectImp& objimp ) const POL_OVERRIDE;
749  virtual BObjectImp* selfDividedByObj( const BLong& objimp ) const POL_OVERRIDE;
750  virtual BObjectImp* selfDividedByObj( const Double& objimp ) const POL_OVERRIDE;
751  virtual void selfDividedByObjImp( BObjectImp& objimp, BObject& obj ) POL_OVERRIDE;
752  virtual void selfDividedByObj( BLong& objimp, BObject& obj ) POL_OVERRIDE;
753  virtual void selfDividedByObj( Double& objimp, BObject& obj ) POL_OVERRIDE;
754 
755  virtual BObjectImp* inverse() const POL_OVERRIDE { return new Double( -dval_ ); }
756  virtual std::string getStringRep() const POL_OVERRIDE;
757  virtual void printOn( std::ostream& ) const POL_OVERRIDE;
758 
759 private:
760  double dval_;
761 };
762 
764 inline void* Double::operator new( std::size_t len )
765 {
766  (void)len;
767  passert_paranoid( len == sizeof( Double ) );
768  return double_alloc.allocate();
769 }
770 inline void Double::operator delete( void* p )
771 {
772  double_alloc.deallocate( p );
773 }
774 
775 class BBoolean : public BObjectImp
776 {
777  typedef BObjectImp base;
778 
779 public:
780 #if BOBJECTIMP_DEBUG
781  explicit BBoolean( bool bval = false );
782  BBoolean( const BBoolean& B );
783 #else
784  explicit BBoolean( bool bval = false ) : BObjectImp( OTBoolean ), bval_( bval ) {}
785  BBoolean( const BBoolean& B ) : BBoolean( B.bval_ ) {}
786 #endif
787 private:
789 
790 public:
791  static BObjectImp* unpack( std::istream& is );
792  virtual std::string pack() const POL_OVERRIDE;
793  virtual void packonto( std::ostream& os ) const POL_OVERRIDE;
794  virtual size_t sizeEstimate() const POL_OVERRIDE;
795 
796  bool value() const { return bval_; }
797 
798 public: // Class Machinery
799  virtual BObjectImp* copy() const POL_OVERRIDE;
800  virtual bool isTrue() const POL_OVERRIDE;
801  virtual bool operator==( const BObjectImp& objimp ) const POL_OVERRIDE;
802 
803  virtual std::string getStringRep() const POL_OVERRIDE;
804  virtual void printOn( std::ostream& ) const POL_OVERRIDE;
805 
806 private:
807  bool bval_;
808 };
809 
810 class BFunctionRef : public BObjectImp
811 {
812  typedef BObjectImp base;
813 
814 public:
815  BFunctionRef( int progcounter, int param_count, const std::string& scriptname );
816  BFunctionRef( const BFunctionRef& B );
817 
818 private:
820 
821 public:
822  virtual size_t sizeEstimate() const POL_OVERRIDE;
823  bool validCall( const int id, Executor& ex, Instruction* inst ) const;
824  bool validCall( const char* methodname, Executor& ex, Instruction* inst ) const;
825 
826 public: // Class Machinery
827  virtual BObjectImp* copy() const POL_OVERRIDE;
828  virtual bool isTrue() const POL_OVERRIDE;
829  virtual bool operator==( const BObjectImp& objimp ) const POL_OVERRIDE;
830 
831  virtual std::string getStringRep() const POL_OVERRIDE;
832 
833  virtual BObjectImp* call_method( const char* methodname, Executor& ex ) POL_OVERRIDE;
834  virtual BObjectImp* call_method_id( const int id, Executor& ex,
835  bool forcebuiltin = false ) POL_OVERRIDE;
836 
837 private:
838  unsigned int pc_;
840  std::string script_name_;
841 };
843 {
844 };
845 
853 class BApplicPtr : public BObjectImp
854 {
855 public:
856  BApplicPtr( const BApplicObjType* pointer_type, void* ptr );
857 
858  const BApplicObjType* pointer_type() const;
859  void* ptr() const;
860 
861 public: // Class Machinery
862  virtual BObjectImp* copy() const POL_OVERRIDE;
863 
864  virtual std::string getStringRep() const POL_OVERRIDE;
865  virtual void printOn( std::ostream& ) const POL_OVERRIDE;
866  virtual size_t sizeEstimate() const POL_OVERRIDE;
867 
868 private:
869  void* ptr_;
871 };
872 
873 
875 {
876 public:
877  explicit BApplicObjBase( const BApplicObjType* object_type );
878 
879  const BApplicObjType* object_type() const;
880 
881 public: // Class Machinery
882  virtual BObjectImp* copy() const POL_OVERRIDE = 0;
883 
884  virtual std::string getStringRep() const POL_OVERRIDE;
885  virtual void printOn( std::ostream& ) const POL_OVERRIDE;
886  virtual size_t sizeEstimate() const POL_OVERRIDE = 0;
887 
888 private:
890 };
891 
892 inline BApplicObjBase::BApplicObjBase( const BApplicObjType* object_type )
893  : BObjectImp( OTApplicObj ), object_type_( object_type )
894 {
895 }
896 
898 {
899  return object_type_;
900 }
901 
902 
903 template <class T>
905 {
906 public:
907  explicit BApplicObj( const BApplicObjType* object_type );
908  BApplicObj( const BApplicObjType*, const T& );
909 
910  T& value();
911  const T& value() const;
912  T* operator->();
913 
914  virtual const char* typeOf() const POL_OVERRIDE = 0;
915  virtual u8 typeOfInt() const POL_OVERRIDE = 0;
916  virtual BObjectImp* copy() const POL_OVERRIDE = 0;
917  virtual size_t sizeEstimate() const POL_OVERRIDE;
918 
919 protected:
920  T obj_;
921 };
922 
923 template <class T>
925 {
926 }
927 
928 template <class T>
930  : BApplicObjBase( object_type ), obj_( obj )
931 {
932 }
933 
934 template <class T>
935 inline size_t BApplicObj<T>::sizeEstimate() const
936 {
937  return sizeof( BApplicObj<T> );
938 }
939 
940 template <class T>
942 {
943  return obj_;
944 }
945 
946 template <class T>
947 const T& BApplicObj<T>::value() const
948 {
949  return obj_;
950 }
951 
952 template <class T>
954 {
955  return &obj_;
956 }
957 }
958 }
959 #endif
double increment()
Definition: bobject.h:715
virtual BObjectImp * selfBitShiftRightObjImp(const BObjectImp &objimp) const
Definition: object.cpp:606
virtual BObjectImp * selfBitOrObj(const BObjectImp &objimp) const
Definition: object.cpp:757
unsigned char u8
Definition: rawtypes.h:25
virtual BObjectRef get_member(const char *membername)
Definition: object.cpp:930
virtual void printOn(std::ostream &) const
Definition: objstrm.cpp:48
std::atomic< int > eobject_imp_count
void deallocate(void *)
Definition: fixalloc.h:140
Clib::fixed_allocator< sizeof(Double), 256 > double_alloc
Definition: object.cpp:45
#define POL_OVERRIDE
virtual std::string getStringRep() const =0
BObjectType type() const
Definition: bobject.h:358
int value() const
Definition: bobject.h:592
virtual BObjectImp * bitnot() const
Definition: object.cpp:851
virtual BObjectImp * selfBitAndObjImp(const BObjectImp &objimp) const
Definition: object.cpp:704
std::vector< std::string > NameCont
Definition: bobject.h:503
virtual BObjectImp * selfTimesObj(const BObjectImp &objimp) const
Definition: object.cpp:463
bool isa(BObjectType type) const
Definition: bobject.h:353
virtual BObjectImp * selfBitOrObjImp(const BObjectImp &objimp) const
Definition: object.cpp:753
void copyvalue(const BLong &ni)
Definition: bobject.h:598
virtual BObjectImp * selfBitXorObj(const BObjectImp &objimp) const
Definition: object.cpp:806
virtual BObjectImp * selfBitShiftRightObj(const BObjectImp &objimp) const
Definition: object.cpp:610
virtual long contains(const BObjectImp &objimp) const
Definition: object.cpp:946
const BApplicObjType * pointer_type_
Definition: bobject.h:870
std::atomic< int > eobject_imp_constructions
Double(const Double &dbl)
Definition: bobject.h:698
virtual BObjectImp * inverse() const POL_OVERRIDE
Definition: bobject.h:597
virtual BObjectImp * inverse() const
Definition: object.cpp:898
STL namespace.
ref_counted & operator=(const ref_counted &)
virtual BObjectImp * copy() const =0
virtual bool operator!=(const BObjectImp &objimp) const
Definition: object.cpp:323
virtual BObjectImp * selfBitShiftLeftObj(const BObjectImp &objimp) const
Definition: object.cpp:659
virtual u8 typeOfInt() const
Definition: object.cpp:263
virtual void operInsertInto(BObject &obj, const BObjectImp &objimp)
Definition: object.cpp:856
unsigned int instance() const
Definition: bobject.h:137
bool isa(BObjectImp::BObjectType type) const
Definition: bobject.h:423
Cont::iterator iterator
Definition: bobject.h:508
virtual char member(const BObject &obj) const
Definition: bobject.h:343
NameCont::iterator name_iterator
Definition: bobject.h:504
virtual void operModulusEqual(BObject &obj, BObjectImp &objimp)
Definition: object.cpp:886
Clib::fixed_allocator< sizeof(BLong), 256 > blong_alloc
Definition: object.cpp:44
virtual BObjectImp * selfBitAndObj(const BObjectImp &objimp) const
Definition: object.cpp:708
virtual std::string pack() const
Definition: object.cpp:201
virtual BObjectRef operDotPlus(const char *name)
Definition: object.cpp:951
BObjectRef(BObject *pobj=NULL)
Definition: bobject.h:454
static void ReleaseSharedInstance()
Definition: bobject.h:483
virtual BObjectImp * copy() const POL_OVERRIDE
Definition: bobject.h:719
virtual size_t sizeEstimate() const POL_OVERRIDE=0
void copyvalue(const Double &dbl)
Definition: bobject.h:714
const BApplicObjType * object_type() const
Definition: bobject.h:897
Cont::const_iterator const_iterator
Definition: bobject.h:509
virtual void operDivideEqual(BObject &obj, BObjectImp &objimp)
Definition: object.cpp:880
void clear()
Definition: refptr.h:282
virtual BObjectImp * selfBitShiftLeftObjImp(const BObjectImp &objimp) const
Definition: object.cpp:655
virtual size_t sizeEstimate() const POL_OVERRIDE
Definition: bobject.h:935
void setimp(BObjectImp *imp)
Definition: bobject.h:446
virtual bool operator==(const BObjectImp &objimp) const
Definition: object.cpp:272
virtual bool isTrue() const
Definition: object.cpp:911
virtual BObjectRef get_member_id(const int id)
Definition: object.cpp:934
virtual BObjectRef set_member(const char *membername, BObjectImp *valueimp, bool copy)
Definition: object.cpp:926
virtual BObjectImp * selfDividedByObj(const BObjectImp &objimp) const
Definition: object.cpp:512
virtual BObjectImp * inverse() const POL_OVERRIDE
Definition: bobject.h:755
Clib::fixed_allocator< sizeof(UninitObject), 256 > uninit_alloc
Definition: object.cpp:43
virtual bool operator<(const BObjectImp &objimp) const
Definition: object.cpp:283
Definition: refptr.h:64
BApplicObjBase(const BApplicObjType *object_type)
Definition: bobject.h:892
unsigned int instance_
Definition: bobject.h:337
BObjectImp * operator->() const
Definition: bobject.h:383
virtual void operPlusEqual(BObject &obj, BObjectImp &objimp)
Definition: object.cpp:862
static Clib::SpinLock bobjectimp_lock
Definition: bobject.h:339
virtual bool operator<=(const BObjectImp &objimp) const
Definition: object.cpp:302
virtual BObjectRef OperSubscript(const BObject &obj)
Definition: object.cpp:903
virtual ContIterator * createIterator(BObject *pIterVal)
Definition: executor.cpp:1003
std::vector< BObjectRef > Cont
Definition: bobject.h:507
static UninitObject * create()
Definition: bobject.h:482
virtual std::string getFormattedStringRep() const
Definition: object.cpp:213
#define passert(exp)
Definition: passert.h:62
virtual void operMinusEqual(BObject &obj, BObjectImp &objimp)
Definition: object.cpp:868
static BObjectImp * unpack(const char *pstr)
Definition: object.cpp:120
virtual BObjectRef set_member_id(const int id, BObjectImp *valueimp, bool copy)
Definition: object.cpp:940
bool value() const
Definition: bobject.h:796
virtual BObjectImp * call_method(const char *methodname, Executor &ex)
Definition: object.cpp:916
BObjectImp * impptr()
Definition: bobject.h:428
Double(double dval=0.0)
Definition: bobject.h:697
virtual BObjectImp * call_method_id(const int id, Executor &ex, bool forcebuiltin=false)
Definition: object.cpp:920
virtual bool isTrue() const POL_OVERRIDE
Definition: bobject.h:718
ref_ptr< BObjectImp > objimp
Definition: bobject.h:404
virtual bool operator>(const BObjectImp &objimp) const
Definition: object.cpp:309
BApplicObj(const BApplicObjType *object_type)
Definition: bobject.h:924
BObject(const BObject &obj)
Definition: bobject.h:367
const BApplicObjType * object_type_
Definition: bobject.h:889
virtual BObjectImp * selfMinusObjImp(const BObjectImp &objimp) const
Definition: object.cpp:410
virtual BObjectRef operDotQMark(const char *name)
Definition: object.cpp:961
virtual BObjectRef OperMultiSubscript(std::stack< BObjectRef > &indices)
Definition: object.cpp:333
BObjectImp & impref()
Definition: bobject.h:438
virtual void packonto(std::ostream &os) const
Definition: object.cpp:208
virtual BObjectImp * selfTimesObjImp(const BObjectImp &objimp) const
Definition: object.cpp:459
virtual BObjectImp * copy() const POL_OVERRIDE=0
BObjectRef(BObjectImp *pimp)
Definition: bobject.h:455
bool isTrue() const
Definition: bobject.h:384
virtual BObjectRef OperMultiSubscriptAssign(std::stack< BObjectRef > &indices, BObjectImp *target)
Definition: object.cpp:344
virtual BObjectImp * selfMinusObj(const BObjectImp &objimp) const
Definition: object.cpp:414
std::string name
Definition: osmod.cpp:943
static ref_ptr< BObjectImp > SharedInstanceOwner
Definition: bobject.h:468
friend std::ostream & operator<<(std::ostream &, const BObjectImp &)
Definition: objstrm.cpp:30
BObjectImp base
Definition: bobject.h:567
NameCont::const_iterator const_name_iterator
Definition: bobject.h:505
virtual BObjectImp * selfModulusObjImp(const BObjectImp &objimp) const
Definition: object.cpp:557
virtual size_t sizeEstimate() const =0
BObjectImp(BObjectType type)
Definition: object.cpp:184
virtual BObjectImp * selfBitXorObjImp(const BObjectImp &objimp) const
Definition: object.cpp:802
std::vector< ref_ptr< BObjectImp > > BObjectImpRefVec
Definition: bobject.h:409
void set(T *ptr)
Definition: refptr.h:275
double value() const
Definition: bobject.h:713
virtual BObjectImp * selfModulusObj(const BObjectImp &objimp) const
Definition: object.cpp:561
virtual BObjectRef operDotMinus(const char *name)
Definition: object.cpp:956
Clib::fixed_allocator< sizeof(BObject), 256 > bobject_alloc
Definition: object.cpp:42
virtual BObjectImp * array_assign(BObjectImp *idx, BObjectImp *target, bool copy)
Definition: object.cpp:328
std::string script_name_
Definition: bobject.h:840
#define passert_paranoid(exp)
Definition: passert.h:95
virtual BObjectImp * selfDividedByObjImp(const BObjectImp &objimp) const
Definition: object.cpp:508
virtual char str_member(const std::string &membername) const
Definition: bobject.h:347
Definition: berror.cpp:12
virtual const char * typeOf() const
Definition: object.cpp:257
virtual bool operator>=(const BObjectImp &objimp) const
Definition: object.cpp:316
static const char * typestr(BObjectType typ)
Definition: object.cpp:218
static UninitObject * SharedInstance
Definition: bobject.h:467
virtual BObjectImp * selfPlusObj(const BObjectImp &objimp) const
Definition: object.cpp:365
virtual void operTimesEqual(BObject &obj, BObjectImp &objimp)
Definition: object.cpp:874
virtual BObjectImp * selfPlusObjImp(const BObjectImp &objimp) const
Definition: object.cpp:361
BObject(BObjectImp *objimp)
Definition: bobject.h:366
static unsigned int instances_
Definition: bobject.h:338
BObjectImp base
Definition: bobject.h:694
virtual BObject operator-() const
Definition: object.cpp:892