soma-io  5.0.5
datasourcelist.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 #ifndef SOMAIO_DATASOURCE_DATASOURCELIST_H
35 #define SOMAIO_DATASOURCE_DATASOURCELIST_H
36 //--- soma-io -----------------------------------------------------------------
38 #include <soma-io/datasource/datasource.h> // to declare rc_ptr of
39 //--- cartobase --------------------------------------------------------------
40 #include <cartobase/smart/rcptr.h> // to declare vector of
41 //--- system -----------------------------------------------------------------
42 #include <string>
43 #include <set>
44 #include <map>
45 #include <vector>
46 //----------------------------------------------------------------------------
47 
48 namespace soma
49 {
70  {
71  public:
72  //======================================================================
73  // C O N S T R U C T O R S
74  //======================================================================
85  const std::string & type = "default" );
87  DataSourceList( const DataSourceList & );
89  virtual ~DataSourceList();
90 
91  //======================================================================
92  // A C C E S S O R S / M U T A T O R S
93  //======================================================================
94  bool operator == ( const DataSourceList & ) const;
95  bool operator != ( const DataSourceList & ) const;
98  bool empty() const;
101  std::set<std::string> types() const;
102  int typecount() const;
103  bool exists( const std::string & ) const;
104  bool empty( const std::string & ) const;
105  int size( const std::string & ) const;
106 
112  dataSource( const std::string & s = "default", int i = 0 ) const ;
118  dataSource( const std::string & s ="default", int i = 0 );
121  void addDataSource( const std::string &,
122  const carto::rc_ptr<DataSource> &);
124  void reset();
125 
126  protected:
127  std::map<std::string,std::vector<carto::rc_ptr<DataSource> > > _dslist;
128  };
129 
130 }
131 
132 #endif
const carto::rc_ptr< DataSource > & dataSource(const std::string &s="default", int i=0) const
Accessing an element of the list If keyword doesn&#39;t exist, or is empty, or coordinate is undefined...
std::map< std::string, std::vector< carto::rc_ptr< DataSource > > > _dslist
void addDataSource(const std::string &, const carto::rc_ptr< DataSource > &)
Adds an element to the dictionary If new keyword, creates it.
int size(const std::string &) const
bool empty() const
Returns true only if no keyword inserted.
void reset()
sets the list and keywords empty.
Definition: allocator.h:48
DataSourceList & operator=(const DataSourceList &)
virtual ~DataSourceList()
bool exists(const std::string &) const
DataSourceList()
Default constructor : Builds a map containing only ( "default", empty pointer )
bool operator!=(const DataSourceList &) const
This class allows to manipulate "lists" of pointers to DataSource.
bool operator==(const DataSourceList &) const
int typecount() const
std::set< std::string > types() const
Returns existing keywords.