Tide 0.1.0

track_operation.h

Go to the documentation of this file.
00001 /* Tide
00002  *
00003  * Header for the track operation elements.
00004  *
00005  * Copyright 2011 Geoffrey Biggs geoffrey.biggs@aist.go.jp
00006  *     RT-Synthesis Research Group
00007  *     Intelligent Systems Research Institute,
00008  *     National Institute of Advanced Industrial Science and Technology (AIST),
00009  *     Japan
00010  *     All rights reserved.
00011  *
00012  * This file is part of Tide.
00013  *
00014  * Tide is free software; you can redistribute it and/or modify it under
00015  * the terms of the GNU Lesser General Public License as published by
00016  * the Free Software Foundation; either version 2.1 of the License, or
00017  * (at your option) any later version.
00018  *
00019  * Tide is distributed in the hope that it will be useful, but WITHOUT
00020  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00021  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00022  * License for more details.
00023  *
00024  * You should have received a copy of the GNU Lesser General Public
00025  * License along with Tide. If not, see <http://www.gnu.org/licenses/>.
00026  */
00027 
00028 #if !defined(TIDE_TRACK_OPERATION_H_)
00029 #define TIDE_TRACK_OPERATION_H_
00030 
00031 #include <boost/operators.hpp>
00032 #include <boost/smart_ptr.hpp>
00033 #include <tide/el_ids.h>
00034 #include <tide/master_element.h>
00035 #include <tide/uint_element.h>
00036 #include <tide/win_dll.h>
00037 #include <vector>
00038 
00041 
00042 namespace tide
00043 {
00048     class TIDE_EXPORT TrackOperationBase : public MasterElement
00049     {
00050         public:
00052             TrackOperationBase(ids::ID id)
00053                 : MasterElement(id)
00054             {}
00055 
00057             virtual ~TrackOperationBase() {}
00058 
00063             virtual std::string type() const = 0;
00064 
00066             typedef boost::shared_ptr<TrackOperationBase> Ptr;
00067     }; // class TrackOperationBase
00068 
00069 
00078     class TIDE_EXPORT TrackJoinBlocks : public TrackOperationBase,
00079             public boost::equality_comparable<TrackJoinBlocks>
00080     {
00081         public:
00083             TrackJoinBlocks();
00084 
00086             ~TrackJoinBlocks() {}
00087 
00089             std::string type() const
00090             {
00091                 return "joinblocks";
00092             }
00093 
00099             void append(uint64_t uid);
00100 
00106             uint64_t remove(unsigned int pos);
00107 
00112             uint64_t operator[](unsigned int pos) const;
00113 
00115             unsigned int count() const { return uids_.size(); }
00116 
00118 
00123             virtual std::streamsize write_body(std::ostream& output);
00124 
00126             friend bool operator==(TrackJoinBlocks const& lhs,
00127                     TrackJoinBlocks const& rhs);
00128 
00129         protected:
00130             std::vector<UIntElement> uids_;
00131 
00133             virtual std::streamsize body_size() const;
00134 
00136             virtual std::streamsize read_body(std::istream& input,
00137                     std::streamsize size);
00138     }; // class TrackJoinBlocks
00139 
00140 
00142     inline bool operator==(TrackJoinBlocks const& lhs,
00143             TrackJoinBlocks const& rhs)
00144     {
00145         return lhs.uids_ == rhs.uids_;
00146     }
00147 }; // namespace tide
00148 
00150 // group elements
00151 
00152 #endif // TIDE_TRACK_OPERATION_H_
00153 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines