Data Access Library (DAL)
/home/amesfoort/DAL/dal/hdf5/Group.h
00001 /* Copyright 2011-2012  ASTRON, Netherlands Institute for Radio Astronomy
00002  * This file is part of the Data Access Library (DAL).
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either 
00007  * version 3 of the License, or (at your option) any later version.
00008  *
00009  * This library 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 GNU
00012  * Lesser 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, see <http://www.gnu.org/licenses/>.
00016  */
00017 #ifndef DAL_GROUP_H
00018 #define DAL_GROUP_H
00019 
00020 #include <string>
00021 #include <vector>
00022 #include <map>
00023 #include <hdf5.h>
00024 #include "types/implicitdowncast.h"
00025 #include "Node.h"
00026 #include "Attribute.h"
00027 
00028 namespace dal {
00029 
00036 class Group: public Node {
00037 public:
00038   Group();
00039 
00040   Group( Group &parent, const std::string &name );
00041 
00042   Group( const Group &other );
00043 
00044   virtual ~Group();
00045 
00046   Group& operator=(Group rhs);
00047 
00048   friend void swap(Group& first, Group& second);
00049 
00055   virtual Group& create();
00056 
00060   virtual bool exists() const;
00061 
00091   void remove() const;
00092 
00098   void set( const Group &other, bool deepcopy );
00099 
00100   Attribute<std::string> groupType();
00101 
00106   std::vector<std::string> nodeNames();
00107 
00108 #ifndef SWIG
00109 
00124   ImplicitDowncast<Node> getNode( const std::string &name );
00125 
00126 #endif
00127 
00128 protected:
00130   hid_gc _group;
00131 
00132 
00133   friend Node::Node( Group &parent, const std::string &name );
00137   const hid_gc &group(); // protected w/ friend above to keep hid_gc inside DAL
00138 
00139   virtual void initNodes();
00140 
00144   void addNode( Node *attr );
00145 
00146   std::vector<std::string> memberNames();
00147 
00149   Group( const hid_gc &fileId, FileInfo fileInfo );
00150 
00151 private:
00153   std::map<std::string, Node*> nodeMap;
00154 
00155   virtual void open( hid_t parent, const std::string &name );
00156 
00157   void freeNodeMap();
00158 };
00159 
00160 }
00161 
00162 #endif
00163 
 All Classes Functions Variables Typedefs Friends