ome-xml  5.6.0
OriginalMetadataAnnotation.h
1 /*
2  * #%L
3  * OME-XML C++ library for working with OME-XML metadata structures.
4  * %%
5  * Copyright © 2006 - 2016 Open Microscopy Environment:
6  * - Massachusetts Institute of Technology
7  * - National Institutes of Health
8  * - University of Dundee
9  * - Board of Regents of the University of Wisconsin-Madison
10  * - Glencoe Software, Inc.
11  * %%
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions are met:
14  *
15  * 1. Redistributions of source code must retain the above copyright notice,
16  * this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright notice,
18  * this list of conditions and the following disclaimer in the documentation
19  * and/or other materials provided with the distribution.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  *
33  * The views and conclusions contained in the software and documentation are
34  * those of the authors and should not be interpreted as representing official
35  * policies, either expressed or implied, of any organization.
36  * #L%
37  */
38 
39 #ifndef OME_XML_MODEL_ORIGINALMETADATAANNOTATION_H
40 #define OME_XML_MODEL_ORIGINALMETADATAANNOTATION_H
41 
42 #include <memory>
43 #include <string>
44 #include <utility>
45 
46 #include <ome/common/xml/dom/Document.h>
47 #include <ome/common/xml/dom/Element.h>
48 #include <ome/common/xml/dom/Node.h>
49 
50 #include <ome/xml/model/XMLAnnotation.h>
51 
52 namespace ome
53 {
54  namespace xml
55  {
56  namespace model
57  {
58 
59  // Forward declarations.
60  class OMEModel;
61 
66  {
67  public:
69  typedef std::pair<std::string, std::string> metadata_type;
70 
71  private:
73  metadata_type metadata;
74 
75  public:
78 
85 
91  OriginalMetadataAnnotation (const metadata_type& map);
92 
104 
106  virtual
108 
109  // Documented in superclass.
110  const std::string&
111  elementName() const;
112 
113  // Documented in superclass.
114  bool
115  validElementName(const std::string& name) const;
116 
118  virtual void
119  update(const common::xml::dom::Element& element,
120  ::ome::xml::model::OMEModel& model);
121 
122  public:
124  bool
125  link (std::shared_ptr<Reference>& reference,
126  std::shared_ptr<::ome::xml::model::OMEModelObject>& object);
127 
133  metadata_type&
134  getMetadata ();
135 
141  const metadata_type&
142  getMetadata () const;
143 
149  void
150  setMetadata (const metadata_type& map);
151 
152  protected:
153  // Documented in base class.
154  virtual void
156  common::xml::dom::Element& element) const;
157  };
158 
159  }
160  }
161 }
162 
163 #endif // OME_XML_MODEL_ORIGINALMETADATAANNOTATION_H
164 
165 /*
166  * Local Variables:
167  * mode:C++
168  * End:
169  */
OME model interface (abstract top-level container)
Definition: OMEModel.h:61
virtual void asXMLElementInternal(common::xml::dom::Document &document, common::xml::dom::Element &element) const
Transform the object hierarchy rooted at this element to XML.
Definition: OriginalMetadataAnnotation.cpp:186
OriginalMetadataAnnotation()
Default constructor.
Definition: OriginalMetadataAnnotation.cpp:67
OriginalMetadataAnnotation model object.
Definition: OriginalMetadataAnnotation.h:65
XMLAnnotation model object.
Definition: XMLAnnotation.h:79
bool validElementName(const std::string &name) const
Check if a given element name is valid for processing by this model object.
Definition: OriginalMetadataAnnotation.cpp:113
virtual ~OriginalMetadataAnnotation()
Destructor.
Definition: OriginalMetadataAnnotation.cpp:101
std::pair< std::string, std::string > metadata_type
Type of original annotation.
Definition: OriginalMetadataAnnotation.h:69
Open Microscopy Environment C++ implementation.
virtual void update(const common::xml::dom::Element &element, ::ome::xml::model::OMEModel &model)
Update the object hierarchy recursively from an XML DOM tree.
Definition: OriginalMetadataAnnotation.cpp:121
metadata_type & getMetadata()
Get the key-value pair mappings.
Definition: OriginalMetadataAnnotation.cpp:194
metadata_type metadata
Original metadata key-value pair.
Definition: OriginalMetadataAnnotation.h:73
bool link(std::shared_ptr< Reference > &reference, std::shared_ptr<::ome::xml::model::OMEModelObject > &object)
Link a given OME model object to this model object.
Definition: OriginalMetadataAnnotation.cpp:172
void setMetadata(const metadata_type &map)
Set the key-value pair mappings.
Definition: OriginalMetadataAnnotation.cpp:206
const std::string & elementName() const
Get the element name of this model object.
Definition: OriginalMetadataAnnotation.cpp:106