ObjectHeader.h

00001 //===========================================================================
00002 // GoTools - SINTEF Geometry Tools version 1.1
00003 //
00004 // GoTools module: CORE
00005 //
00006 // Copyright (C) 2000-2007 SINTEF ICT, Applied Mathematics, Norway.
00007 //
00008 // This program is free software; you can redistribute it and/or          
00009 // modify it under the terms of the GNU General Public License            
00010 // as published by the Free Software Foundation version 2 of the License. 
00011 //
00012 // This program is distributed in the hope that it will be useful,        
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of         
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          
00015 // GNU General Public License for more details.                           
00016 //
00017 // You should have received a copy of the GNU General Public License      
00018 // along with this program; if not, write to the Free Software            
00019 // Foundation, Inc.,                                                      
00020 // 59 Temple Place - Suite 330,                                           
00021 // Boston, MA  02111-1307, USA.                                           
00022 //
00023 // Contact information: E-mail: tor.dokken@sintef.no                      
00024 // SINTEF ICT, Department of Applied Mathematics,                         
00025 // P.O. Box 124 Blindern,                                                 
00026 // 0314 Oslo, Norway.                                                     
00027 //
00028 // Other licenses are also available for this software, notably licenses
00029 // for:
00030 // - Building commercial software.                                        
00031 // - Building software whose source code you wish to keep private.        
00032 //===========================================================================
00033 #ifndef _GOOBJECTHEADER_H
00034 #define _GOOBJECTHEADER_H
00035 
00036 
00037 #include <vector>
00038 #include "ClassType.h"
00039 #include "Streamable.h"
00040 
00041 namespace Go
00042 {
00045 
00046 
00054 class ObjectHeader : public Streamable
00055 {
00056 public:
00058     ObjectHeader()
00059         : class_type_(Class_Unknown),
00060           major_version_(0),
00061           minor_version_(0)
00062     {}
00063 
00070     ObjectHeader(ClassType t, int major, int minor)
00071         : class_type_(t),
00072           major_version_(major),
00073           minor_version_(minor)
00074     {}
00075 
00084     ObjectHeader(ClassType t, int major, int minor,
00085                    const std::vector<int>& auxdata)
00086         : class_type_(t),
00087           major_version_(major),
00088           minor_version_(minor),
00089           auxillary_data_(auxdata)
00090     {}
00091 
00093     virtual ~ObjectHeader();
00094 
00097     virtual void read (std::istream& is);
00098 
00101     virtual void write (std::ostream& os) const;
00102 
00104     ClassType classType() { return class_type_; }
00105 
00107     int majorVersion() { return major_version_; }
00108 
00110     int minorVersion() { return minor_version_; }
00111 
00114     int auxdataSize() { return auxillary_data_.size(); }
00115 
00118     int auxdata(int i) { return auxillary_data_[i]; }
00119 
00120 private:
00121     ClassType class_type_;
00122     int major_version_;
00123     int minor_version_;
00124     std::vector<int> auxillary_data_;
00125 };
00126 
00127 
00129 } // namespace Go
00130 
00131 
00132 #endif // _GOOBJECTHEADER_H
00133 
00134 

Generated on Mon Jun 11 14:48:18 2007 for GoTools Core Library by  doxygen 1.5.1