Changeset 355 in dev for trunk/abdev/BasicCompiler_Common/include/DataTable.h
- Timestamp:
- Nov 2, 2007, 2:53:56 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler_Common/include/DataTable.h
r279 r355 4 4 5 5 //DataTable.cpp 6 class DataTable{ 6 class DataTable 7 { 7 8 char *buffer; 8 9 int size; 9 10 10 void Realloc( int size ) 11 { 12 this->buffer = (char *)realloc( this->buffer, size + 100 ); 13 this->size = size; 14 } 11 public: 12 // リンカで解決しなければならないスケジュール 13 Schedules schedules; 15 14 16 15 // XMLシリアライズ用 … … 23 22 ar & BOOST_SERIALIZATION_NVP( _buffer ); 24 23 ar & BOOST_SERIALIZATION_NVP( size ); 24 ar & BOOST_SERIALIZATION_NVP( schedules ); 25 25 26 26 // 読み込み後の処理 … … 52 52 ar & BOOST_SERIALIZATION_NVP( _buffer ); 53 53 ar & BOOST_SERIALIZATION_NVP( size ); 54 ar & BOOST_SERIALIZATION_NVP( schedules ); 55 } 56 57 58 void Realloc( int size ) 59 { 60 this->buffer = (char *)realloc( this->buffer, size + 100 ); 61 this->size = size; 54 62 } 55 63 … … 92 100 void Add( const DataTable &dataTable ) 93 101 { 102 long baseOffset = GetSize(); 103 94 104 AddBinary( dataTable.GetPtr(), dataTable.GetSize() ); 105 106 // スケジュールを追加 107 BOOST_FOREACH( const Schedule &schedule, dataTable.schedules ) 108 { 109 this->schedules.push_back( 110 Schedule( 111 schedule.GetType(), 112 baseOffset + schedule.GetOffset(), 113 schedule.GetLongPtrValue() 114 ) 115 ); 116 } 95 117 } 96 118 97 const void *GetPtr() const; 98 int GetSize() const; 119 const void *GetPtr() const 120 { 121 return buffer; 122 } 123 int GetSize() const 124 { 125 return size; 126 } 127 128 long GetLong( int pos ) const 129 { 130 return *(long *)( buffer + pos ); 131 } 132 _int64 GetInt64( int pos ) const 133 { 134 return *(_int64 *)( buffer + pos ); 135 } 136 void Overwrite( int pos, long newLongValue ) 137 { 138 *(long *)( buffer + pos ) = newLongValue; 139 } 140 void OverwriteInt64( int pos, _int64 new64Value ) 141 { 142 *(_int64 *)( buffer + pos ) = new64Value; 143 } 144 145 bool MakeConstObjectToProcessStaticBuffer( const CClass &objClass, const Jenga::Common::Strings &initMemberValues, int &dataTableOffset ); 146 bool MakeConstObjectToProcessStaticBuffer( const char *expression, Type &resultType, int &dataTableOffset ); 147 int MakeConstStringObjectToProcessStaticBuffer( const char *str ); 148 bool MakeLiteralArrayBuffer( const char *expression, const Type &baseType, int &dataTableOffset ); 149 150 private: 151 int lastMadeConstObjectDataTableOffset; 152 public: 153 int GetLastMadeConstObjectDataTableOffset() 154 { 155 return lastMadeConstObjectDataTableOffset; 156 } 157 158 void ResetDataSectionBaseOffset( long dataSectionBaseOffset ); 99 159 };
Note:
See TracChangeset
for help on using the changeset viewer.