moab
|
00001 00017 /********************************************** 00018 * Filename : SparseTagSuperCollection.hpp 00019 * 00020 * Purpose : To store any size data with 00021 * any entity handle 00022 * 00023 * Creator : Clinton Stimpson 00024 * 00025 * Date : 3 April 2002 00026 * 00027 * ********************************************/ 00028 00029 00030 00031 #ifndef SPARSE_TAG_SUPER_COLLECTION_HPP 00032 #define SPARSE_TAG_SUPER_COLLECTION_HPP 00033 00034 #ifndef IS_BUILDING_MB 00035 #error "SparseTagSuperCollection.hpp isn't supposed to be included into an application" 00036 #endif 00037 00038 #ifdef WIN32 00039 #pragma warning(disable : 4786) 00040 #endif 00041 00042 #include <map> 00043 #include <vector> 00044 00045 #include "moab/Types.hpp" 00046 #include "Internals.hpp" 00047 #include "moab/Range.hpp" 00048 #include "TagInfo.hpp" 00049 00050 #define get_collection( A ) ((A) < mDataTags.size() ? mDataTags[(A)] : 0) 00051 00052 namespace moab { 00053 00054 class SparseTagCollection; 00055 00057 class SparseTagSuperCollection 00058 { 00059 public: 00061 SparseTagSuperCollection(){} 00062 00064 virtual ~SparseTagSuperCollection(); 00065 00066 void reset_data(); 00067 00069 ErrorCode reserve_tag_id(int data_size, TagId tag_id); 00070 00072 ErrorCode release_tag_id(TagId tag_id); 00073 00075 int tag_size(const TagId tag_id) const; 00076 00080 ErrorCode set_data( TagId tag_handle, 00081 const EntityHandle* handles, 00082 int num_handles, 00083 const void* data ); 00084 00094 ErrorCode set_data( TagId tag_handle, 00095 const EntityHandle* handles, 00096 int num_handles, 00097 void const* const* data_pointers, 00098 const int* lengths = 0, 00099 bool one_value = false ); 00100 00104 ErrorCode set_data( TagId tag_handle, 00105 const Range& handles, 00106 const void* data ); 00107 00120 ErrorCode set_data( TagId tag_handle, 00121 const Range& handles, 00122 void const* const* data_pointers, 00123 const int* lengths = 0, 00124 bool one_value = false ); 00125 00149 ErrorCode tag_iterate( TagId tag_handle, 00150 Range::iterator& iter, 00151 const Range::iterator& end, 00152 void*& data_ptr, 00153 const void* default_value ); 00154 00159 ErrorCode get_data( TagId tag_handle, 00160 const EntityHandle* handles, 00161 int num_handles, 00162 void* data, 00163 const void* default_value ) const; 00164 00175 ErrorCode get_data( TagId tag_handle, 00176 const EntityHandle* handles, 00177 int num_handles, 00178 const void** data, 00179 int* lengths, 00180 const void* default_value, 00181 int default_value_length ) const; 00182 00187 ErrorCode get_data( TagId tag_handle, 00188 const Range& handles, 00189 void* data, 00190 const void* default_value ) const; 00191 00206 ErrorCode get_data( TagId tag_handle, 00207 const Range& handles, 00208 const void** data, 00209 int* lengths, 00210 const void* default_value, 00211 int default_value_length ) const; 00212 00214 ErrorCode remove_data(const TagId tag_handle, const EntityHandle entity_handle); 00215 00217 ErrorCode get_entities(const TagId tag_handle, Range &entities); 00218 00220 ErrorCode get_entities(const TagId tag_handle, const EntityType type, 00221 Range &entities); 00222 00224 ErrorCode get_entities(const Range &range, 00225 const TagId tag_handle, const EntityType type, 00226 Range &entities); 00227 00229 ErrorCode get_tags(const EntityHandle entity, 00230 std::vector<Tag> &all_tags); 00231 00233 ErrorCode get_entities_with_tag_value( const TagId tag_handle, 00234 const TagInfo& tag_info, 00235 const EntityType type, 00236 Range &entities, 00237 const void* tag_value, 00238 int value_size); 00239 00241 ErrorCode get_entities_with_tag_value( const Range &range, 00242 const TagId tag_handle, 00243 const TagInfo& tag_info, 00244 const EntityType type, 00245 Range &entities, 00246 const void* tag_value, 00247 int value_size); 00248 00250 ErrorCode get_number_entities(const TagId tag_handle, const EntityType type, int& num_ent); 00251 00252 00254 ErrorCode get_number_entities(const Range &range, 00255 const TagId tag_handle, const EntityType type, int& num_ent); 00256 00257 ErrorCode get_memory_use( TagId tag_id, 00258 unsigned long& total, 00259 unsigned long& per_entity ); 00260 00261 private: 00262 00263 std::vector<SparseTagCollection*> mDataTags; 00264 }; 00265 00266 } // namespace moab 00267 00268 #endif //SPARSE_TAG_SUPER_COLLECTION_HPP 00269 00270 00271 00272