root/juggler/branches/1.0/Config/vjChunkDescDB.h

Revision 8789, 5.0 kB (checked in by patrickh, 7 years ago)

Copyright update.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /*************** <auto-copyright.pl BEGIN do not edit this line> **************
2  *
3  * VR Juggler is (C) Copyright 1998, 1999, 2000, 2001, 2002
4  *   by Iowa State University
5  *
6  * Original Authors:
7  *   Allen Bierbaum, Christopher Just,
8  *   Patrick Hartling, Kevin Meinert,
9  *   Carolina Cruz-Neira, Albert Baker
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Library General Public
13  * License as published by the Free Software Foundation; either
14  * version 2 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Library General Public License for more details.
20  *
21  * You should have received a copy of the GNU Library General Public
22  * License along with this library; if not, write to the
23  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24  * Boston, MA 02111-1307, USA.
25  *
26  * -----------------------------------------------------------------
27  * File:          $RCSfile$
28  * Date modified: $Date$
29  * Version:       $Revision$
30  * -----------------------------------------------------------------
31  *
32  *************** <auto-copyright.pl END do not edit this line> ***************/
33
34
35 #ifndef _VJ_CHUNKDESCDB_H_
36 #define _VJ_CHUNKDESCDB_H_
37
38 #include <vjConfig.h>
39 #include <Config/vjChunkDesc.h>
40
41 //--------------------------------------------------------------
42 //: Storage class for vjChunkDescs used by the ConfigChunkDB.
43 //
44 //  A vjChunkDescDB is a container for vjChunkDescs.  Includes
45 //  functions to search for particular vjChunkDescs, and to read
46 //  and write ChunkDesc files.
47 //
48 // @author Christopher Just
49 // October 1997
50 //!PUBLIC_API:
51 //-----------------------------------------------------------------
52
53
54 class vjChunkDescDB {
55 private:
56
57     //:Internal storage of vjChunkDescs
58     std::vector<vjChunkDesc*> descs;
59
60 public:
61
62     //:Default Constructor
63     //!POST: Self is created with an empty vector of vjChunkDescs
64     vjChunkDescDB ();
65
66
67     //:Destructor
68     //!POST: Self is destroyed; all memory (including contained
69     //+      vjChunkDescs) is destroyed.
70     ~vjChunkDescDB ();
71
72
73     //:Searches for a particular vjChunkDesc
74     //!RETURNS: desc - a vjChunkDesc whose token matches _token
75     //!RETURNS: NULL - if no such vjChunkDesc is found
76     vjChunkDesc *getChunkDesc (const std::string& _token);
77
78
79     //:Inserts a vjChunkDesc
80     //!ARGS: d - non-NULL pointer to vjChunkDesc
81     //!POST: d is inserted into self, replacing any vjChunkDesc
82     //+      with the same token.
83     //!RETURNS: True - always.
84     bool insert (vjChunkDesc *d);
85
86
87     //:Inserts all vjChunkDescs in db
88     //!ARGS: db - a non-NULL pointer to a vjChunkDescDB
89     //!POST: all elements of db are inserted into self, replacing any
90     //+      existing vjChunkDescs with the same token.
91     void insert (vjChunkDescDB* db);
92    
93
94     //:Removes vjChunkDesc from self
95     //!ARGS: _token - a non-NULL C string
96     //!POST: Any vjChunkDesc in self whose token equals _token
97     //+      is removed and destroyed.
98     //!RETURNS: true - if a matching chunk was found
99     //!RETURNS: false - if no matching chunk was found
100     bool remove (const std::string& name);
101
102
103     //:Removes all vjChunkDescs from self
104     //!POST: All vjChunkDescs in self have been removed and
105     //+      destroyed
106     //!NOTE: This <b>can</b> be dangerous, if there exist
107     //+      vjConfigChunks somewhere that rever to any of
108     //+      the deleted vjChunkDescs.
109     void removeAll ();
110
111
112     //:Returns the number of vjChunkDescs in self.
113     //!RETURNS: n - the number of vjChunkDescs in self.
114     int size ();
115
116
117     //:Writes self to out
118     //!POST: A text representation of self is appended to out
119     //!RETURNS: out
120     //!NOTE: The output format is zero or more vjChunkDescs
121     //+      followed by "end"
122     friend std::ostream& operator << (std::ostream& out, vjChunkDescDB& self);
123
124
125     //:Reads from in
126     //!POST: vjChunkDescs read from in are appended to self.
127     //+      vjChunkDescs previously in self are retained.
128     //!NOTE: input format is zero or more vjChunkDescs followed
129     //+      by "End" or eof.
130     friend std::istream& operator >> (std::istream& in, vjChunkDescDB& self);
131
132
133     //:Loads a chunkdesc file
134     //!ARGS: fname - name of file to load
135     //!POST: File is opened and vjChunkDescs are read and inserted
136     //+      into self (using >>).
137     //!RETURNS: true - if file was opened succesfully
138     //!RETURNS: false - otherwise
139     //!NOTE: Return value only deals with opening the file, and
140     //+      true doesn't neccessarily mean no parsing errors
141     //+      occurred.
142     bool load (const std::string& filename, const std::string& parentfile = "");
143
144
145     //:Saves a chunkdesc file
146     //!ARGS: fname - name of file to load
147     //!POST: File is opened and vjChunkDescs are written to it
148     //+      using << operator.
149     //!RETURNS: true - if file was opened succesfully
150     //!RETURNS: false - otherwise
151     bool save (const char *fname);
152
153 };
154
155 #endif
Note: See TracBrowser for help on using the browser.