record.h

00001 /***************************************************************************
00002  *   Copyright (C) 2001 by Rick L. Vinyard, Jr.                            *
00003  *   rvinyard@cs.nmsu.edu                                                  *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Lesser General Public License as        *
00007  *   published by the Free Software Foundation version 2.1.                *
00008  *                                                                         *
00009  *   This program is distributed in the hope that it will be useful,       *
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00012  *   GNU General Public License for more details.                          *
00013  *                                                                         *
00014  *   You should have received a copy of the GNU Lesser General Public      *
00015  *   License along with this library; if not, write to the                 *
00016  *   Free Software Foundation, Inc.,                                       *
00017  *   51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA              *
00018  ***************************************************************************/
00019 #ifndef BITRECORD_H
00020 #define BITRECORD_H
00021 
00022 #include <string>
00023 
00024 #include <libxml++/libxml++.h>
00025 
00026 #include <bit/recordbase.h>
00027 #include <bit/recordstorage.h>
00028 
00034 namespace bit
00035   {
00036 
00054   class Record: public RecordBase
00055     {
00056     public:
00057 
00059       typedef boost::shared_ptr<Record> pointer;
00060 
00062       Record( std::string name="",
00063               size_t length_units=BITS,
00064               int offset=0,
00065               size_t offset_units=BITS,
00066               std::string descr=""
00067             );
00068 
00070       static Record::pointer create( std::string name="",
00071                                      size_t length_units=BITS,
00072                                      int offset=0,
00073                                      size_t offset_units=BITS,
00074                                      std::string descr=""
00075                                    );
00076 
00078       virtual ~Record();
00079 
00081       virtual size_t length() const;
00082 
00083       virtual size_t length(size_t units) const;
00084 
00085       virtual iterator begin();
00086 
00087       virtual iterator end();
00088 
00089      virtual FieldBase::pointer field(std::string s);
00090 
00091       virtual FieldBase::pointer field(size_t i);
00092 
00093       virtual void add_field(FieldBase::pointer field);
00094 
00095       virtual void remove_field(FieldBase::pointer field);
00096 
00097       virtual void remove_field(const std::string& name);
00098 
00099       virtual size_t fields();
00100 
00101       virtual FieldBase::pointer clone();
00102 
00103     protected:
00104 
00105       RecordStorage m_fields;
00106 
00107       virtual FieldBase::pointer previous_field(FieldBase::pointer current_field) throw (error::invalid_container_op);
00108 
00109       virtual FieldBase::pointer next_field(FieldBase::pointer current_field) throw (error::invalid_container_op);
00110     };
00111 
00112 }
00113 
00114 #endif

Generated on Thu Jul 6 14:38:08 2006 by  doxygen 1.4.6