moab
EntitySequence.hpp
Go to the documentation of this file.
00001 #ifndef ENTITY_SEQUENCE_HPP
00002 #define ENTITY_SEQUENCE_HPP
00003 
00004 #include "moab/Types.hpp"
00005 #include "Internals.hpp"
00006 
00007 namespace moab {
00008 
00009 class SequenceData;
00010 
00011 class EntitySequence {
00012 private:
00013   EntityHandle startHandle, endHandle;
00014   SequenceData* sequenceData;
00015 
00016 protected:
00017 
00018   EntitySequence( EntityHandle h )
00019     : startHandle(h), endHandle(h) {}
00020 
00021   EntitySequence( EntitySequence& split_from, EntityHandle here )
00022     : startHandle( here ),
00023       endHandle( split_from.endHandle ),
00024       sequenceData( split_from.sequenceData )
00025   {
00026     split_from.endHandle = here - 1;
00027   }
00028 
00029   SequenceData* create_data_subset( EntityHandle start_handle,
00030                                     EntityHandle end_handle,
00031                                     int num_sequence_arrays,
00032                                     unsigned const* bytes_per_element ) const;
00033 
00034   ErrorCode prepend_entities( EntityID count );
00035   ErrorCode append_entities( EntityID count );
00036 
00037 public:
00038 
00039   EntitySequence( EntityHandle start, EntityID count, SequenceData* dat )
00040     : startHandle(start), endHandle( start + count - 1 ), sequenceData( dat )
00041     {}
00042 
00043   virtual ~EntitySequence() {}
00044 
00045   EntityType type() const
00046     { return TYPE_FROM_HANDLE(start_handle()); }
00047 
00048   EntityHandle start_handle() const
00049     { return startHandle; }
00050   
00051   EntityHandle end_handle() const
00052     { return endHandle; }
00053   
00054   SequenceData* data() const
00055     { return sequenceData; }
00056     
00057   void data( SequenceData* ptr )
00058     { sequenceData = ptr; }
00059   
00060   EntityID size() const
00061     { return endHandle - startHandle + 1; }
00062     
00065   bool using_entire_data() const;
00066   
00075   virtual int values_per_entity() const;
00076   
00083   virtual EntitySequence* split( EntityHandle here ) = 0;
00084 
00090   virtual ErrorCode merge( EntitySequence& other );
00091   
00093   virtual ErrorCode pop_back( EntityID count );
00094   
00096   virtual ErrorCode pop_front( EntityID count );
00097   
00105   virtual SequenceData* create_data_subset( EntityHandle start_handle,
00106                                             EntityHandle end_handle ) const = 0;
00107 
00117   virtual void get_const_memory_use( unsigned long& bytes_per_entity,
00118                                      unsigned long& size_of_sequence ) const = 0;
00124   virtual unsigned long get_per_entity_memory_use( EntityHandle first,
00125                                                    EntityHandle last ) const;
00126 };
00127   
00128 } // namespace moab
00129 
00130 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines