Loading...
Searching...
No Matches
MetadataManager.h
Go to the documentation of this file.
1/* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2
3 This file is part of the TerraLib - a Framework for building GIS enabled applications.
4
5 TerraLib is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 TerraLib is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with TerraLib. See COPYING. If not, write to
17 TerraLib Team at <terralib-team@terralib.org>.
18 */
19
20/*!
21 \file terralib/metadata/MetadataManager.h
22 */
23
24
25#ifndef __TERRALIB_METADATA_INTERNAL_METADATAMANAGER_H
26#define __TERRALIB_METADATA_INTERNAL_METADATAMANAGER_H
27
28// TerraLib
29#include "../common/Singleton.h"
30
31// STL
32#include <map>
33#include <string>
34
35namespace te
36{
37 namespace md
38 {
39 class MetadataAnnotation;
40
41 /*!
42 \class MetadataManager
43
44 \brief This singleton defines the TerraLib metadata record manager entry.
45
46 \todo Persistence of the catalogue of annotations. Possibly in DBMS and/or JSON files.
47 \todo Publish capabilility: the manager should be able to publish its contents to a metadata catalogue such as GeoNetwork.
48 */
49 class TEMDEXPORT MetadataManager: public te::common::Singleton<MetadataManager>
50 {
52
53 public:
54
55 /** @name MetadataManager Accessor Method
56 * Method used to access the data stored on this manager.
57 */
58 //@{
59
60 /*!
61 \brief Inserts a new metadata annotation to the manager
62
63 \param a Pointer to the new metadata annotation. Class takes pointer ownership. Do not pass null.
64
65 \exception te::md::Exception If the annotation is already managed.
66 */
68
69
70 /*!
71 \brief Removes the annotation from the manager and frees its resources.
72
73 \param a Pointer to the annnotation to be removed. This pointer will be freed and invalidated.
74
75 \exception te::md::Exception If the annotation doesn't exist.
76 */
78
79 /*!
80 \brief Searches for an annotation, given its identification.
81
82 \param aid The name annotation identification.
83
84 \return A pointer to the annotation if found or NULL otherwise. Class maintains the ownership of returned pointer.
85 */
86 const MetadataAnnotation* find(const std::string& aid) const;
87
88 /*!
89 \brief Gives access to the set of metadata annotations.
90
91 \return A const reference to the set of annotation indexed by it's id.
92 */
93 const std::map<std::string,MetadataAnnotation*>& getAnnotations() const;
94
95 /*!
96 \brief Check wheter the manager is empty.
97
98 \return True if there is no annotation in the manager and false otherwise.
99 */
100 bool isEmpty() const;
101
102 /*!
103 \brief Removes all the annotation from the manager.
104 */
105 void clear();
106
107 //! Returns a begin iterator to the annotations managed.
108 const std::map<std::string,MetadataAnnotation*>::const_iterator getBeginIterator() const;
109
110 //! Returns an end iterator pointing to the annotations managed.
111 const std::map<std::string,MetadataAnnotation*>::const_iterator getEndIterator() const;
112
113 //@}
114
115 /** @name Initializer Methods
116 * Methods related to instantiation and destruction.
117 */
118 //@{
119
120 /*! \brief Destructor. */
122
123 protected:
124
125
126 /*! \brief It initializes the Singleton. */
128
129 //@}
130
131 private:
132
133 std::map<std::string,MetadataAnnotation*> m_metadata;
134
135 };
136 }
137}
138#endif // __TERRALIB_METADATA_INTERNAL_METADATAMANAGER_H
Template support for singleton pattern.
Definition: Singleton.h:101
A class to relate a metadata annotation to a TerraLib element (or entity).
This singleton defines the TerraLib metadata record manager entry.
const std::map< std::string, MetadataAnnotation * >::const_iterator getBeginIterator() const
Returns a begin iterator to the annotations managed.
void clear()
Removes all the annotation from the manager.
void insert(MetadataAnnotation *a)
Inserts a new metadata annotation to the manager.
~MetadataManager()
Destructor.
const std::map< std::string, MetadataAnnotation * > & getAnnotations() const
Gives access to the set of metadata annotations.
std::map< std::string, MetadataAnnotation * > m_metadata
const MetadataAnnotation * find(const std::string &aid) const
Searches for an annotation, given its identification.
void erase(MetadataAnnotation *a)
Removes the annotation from the manager and frees its resources.
MetadataManager()
It initializes the Singleton.
bool isEmpty() const
Check wheter the manager is empty.
const std::map< std::string, MetadataAnnotation * >::const_iterator getEndIterator() const
Returns an end iterator pointing to the annotations managed.
TerraLib.
#define TEMDEXPORT
Definition: Config.h:61