FDO API Reference Feature Data Objects

FeatureSchema.h

Go to the documentation of this file.
00001 #ifndef _FEATURESCHEMA_H_
00002 #define _FEATURESCHEMA_H_
00003 
00004 //
00005 // Copyright (C) 2004-2006  Autodesk, Inc.
00006 // 
00007 // This library is free software; you can redistribute it and/or
00008 // modify it under the terms of version 2.1 of the GNU Lesser
00009 // General Public License as published by the Free Software Foundation.
00010 // 
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 // 
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00019 //
00020 
00021 #ifdef _WIN32
00022 #pragma once
00023 #endif
00024 
00025 #include <FdoStd.h>
00026 #include <Fdo/Schema/SchemaElement.h>
00027 #include <Fdo/Schema/ClassDefinition.h>
00028 #include <Fdo/Schema/SchemaCollection.h>
00029 #include <Fdo/Schema/ClassCollection.h>
00030 #include <Fdo/Xml/Serializable.h>
00031 
00032 class FdoRelationCollection;
00033 class FdoRelation;
00034 
00035 /// \brief
00036 /// The FdoFeatureSchema class derives from FdoSchemaElement.
00037 /// A feature schema contains all of the classes and relationships
00038 /// that make up a particular data model. The FdoFeatureSchema class can be used to
00039 /// either create a new schema or to browse the schema end of a
00040 /// connection. In the later case, the FdoFeatureSchema instance is created by the
00041 /// DescribeSchema command. In this case the schema objects have additional properties,
00042 /// such as coordinate system definitions that can be useful to the
00043 /// application when placed in context with the schema objects.
00044 class FdoFeatureSchema : 
00045     public FdoSchemaElement,
00046     public FdoXmlSerializable
00047 {
00048 protected:
00049 /// \cond DOXYGEN-IGNORE
00050     /// Constructs a default empty instance of an FdoFeatureSchema.
00051     FdoFeatureSchema();
00052 
00053     /// Constructs an instance of an FdoFeatureSchema using the specified arguments.
00054     FdoFeatureSchema(FdoString* name, FdoString* description);
00055 
00056     virtual ~FdoFeatureSchema();
00057 
00058     virtual void Dispose();
00059 /// \endcond
00060 
00061 public:
00062     /// \brief
00063     /// Constructs a default empty instance of an FdoFeatureSchema.
00064     /// 
00065     /// \return
00066     /// Returns FdoFeatureSchema
00067     /// 
00068     FDO_API static FdoFeatureSchema* Create();
00069 
00070     /// \brief
00071     /// Constructs an instance of an FdoFeatureSchema using the specified arguments.
00072     /// 
00073     /// \param name 
00074     /// Input name
00075     /// \param description 
00076     /// Input description
00077     /// 
00078     /// \return
00079     /// Returns FdoFeatureSchema
00080     /// 
00081     FDO_API static FdoFeatureSchema* Create(FdoString* name, FdoString* description);
00082 
00083     /// \brief
00084     /// Returns an FdoClassCollection that contains all of the classes defined in
00085     /// the feature schema.
00086     /// 
00087     /// \return
00088     /// Returns an FdoClassCollection
00089     /// 
00090     FDO_API FdoClassCollection* GetClasses();
00091 
00092     /// \brief
00093     /// Returns an FdoRelationCollection that contains all of the relations defined
00094     /// in the feature schema.
00095     /// 
00096     /// \return
00097     /// Returns nothing
00098     /// 
00099     FDO_API FdoRelationCollection* GetRelations();
00100 
00101     /// \brief
00102     /// Accepts all of the changes that have been made to the feature schema.
00103     /// All child elements with a schema element state set to
00104     /// FdoSchemaElementState_Deleted are physically removed from the schema. All
00105     /// other child elements have their schema element state values set to
00106     /// FdoSchemaElementState_Unchanged.
00107     /// This method would usually be only called from an FDO Provider (IApplySchema
00108     /// implementation). It would not normally called by an FDO Client.
00109     /// 
00110     /// \return
00111     /// Returns nothing
00112     /// 
00113     FDO_API void AcceptChanges();
00114 
00115     /// \brief
00116     /// Rejects all of the changes that have been made to the feature schema.
00117     /// All child elements with a schema element state set to
00118     /// FdoSchemaElementState_Added are physically removed from the schema. All other 
00119     /// child elements are restored to their original states and have their schema 
00120     /// element state values set to FdoSchemaElementState_Unchanged.
00121     /// 
00122     /// \return
00123     /// Returns nothing
00124     /// 
00125     FDO_API void RejectChanges();
00126 
00127     /// \brief
00128     /// Gets the stylesheet for converting a Feature Schema collection from 
00129     /// internal to external XML format. The internal format is very similar to 
00130     /// the Feature Schema class hierarchy. The external format is OGC GML.
00131     /// 
00132     /// \return
00133     /// Returns the stylesheet
00134     /// 
00135     FDO_API virtual FdoXmlReader* GetFromInternalStylesheet();
00136 
00137 /// \cond DOXYGEN-IGNORE
00138     /// Public non-API functions for XML serialization
00139 
00140     /// Merge the given schema into this schema. An additive merge
00141     /// is performed. 
00142     void Set( FdoFeatureSchema* pSchema, FdoSchemaXmlContext* pContext );
00143 
00144     /// Allows FeatureSchemaCollection to get the stylesheet.
00145     static FdoXmlReader* _getFromInternalStylesheet();
00146 
00147     /// FdoXmlDeserializabe callback override to handle start of sub-elements 
00148     //when deserializing from XML.
00149     virtual FdoXmlSaxHandler* XmlStartElement(
00150         FdoXmlSaxContext* context, 
00151         FdoString* uri, 
00152         FdoString* name, 
00153         FdoString* qname, 
00154         FdoXmlAttributeCollection* atts
00155     );
00156 
00157     /// FdoXmlSerializabe callback override to serialize this feature schema
00158     /// to XML.
00159     virtual void _writeXml( FdoXmlWriter* xmlWriter, const FdoXmlFlags* flags );
00160     virtual void _writeXml( FdoSchemaXmlContext* pContext );
00161 /// \endcond
00162 
00163 private:
00164     FdoClassCollection*         m_classes;
00165 };
00166 
00167 /// \brief
00168 /// FdoFeatureSchemaP is a FdoPtr on FdoFeatureSchema, provided for convenience.
00169 typedef FdoPtr<FdoFeatureSchema> FdoFeatureSchemaP;
00170 
00171 #endif
00172 
00173 

Comments or suggestions? Send us feedback.