FDO API Reference Feature Data Objects

ProviderCollection.h

Go to the documentation of this file.
00001 #ifndef _FDOPROVIDERCOLLECTION_H_
00002 #define _FDOPROVIDERCOLLECTION_H_
00003 /***************************************************************************
00004 
00005 //
00006 // Copyright (C) 2004-2006  Autodesk, Inc.
00007 // 
00008 // This library is free software; you can redistribute it and/or
00009 // modify it under the terms of version 2.1 of the GNU Lesser
00010 // General Public License as published by the Free Software Foundation.
00011 // 
00012 // This library is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 // Lesser General Public License for more details.
00016 // 
00017 // You should have received a copy of the GNU Lesser General Public
00018 // License along with this library; if not, write to the Free Software
00019 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020 //
00021 
00022  *
00023  ***************************************************************************/
00024 #ifdef _WIN32
00025 #pragma once
00026 #endif
00027 
00028 // Include definitions
00029 #include <vector>
00030 #include <FdoStd.h>
00031 #include <Fdo/ClientServices/ClientServices.h>
00032 #include <Fdo/ClientServices/Provider.h>
00033 
00034 /// \brief
00035 /// Read only collection of information describing each of the installed feature providers
00036 class FdoProviderCollection : public FdoIDisposable
00037 {
00038     /// Instances of interface FdoProviderRegistry are responsible for the 
00039     /// lifespan of FdoProviderCollection
00040     friend class FdoProviderRegistry;
00041 
00042 protected:
00043 /// \cond DOXYGEN-IGNORE
00044     /// Constructs a default instance of a FdoProviderCollection.
00045     FdoProviderCollection();
00046 
00047     /// Default destructor for FdoProviderCollection.
00048     virtual ~FdoProviderCollection();
00049 
00050     virtual void Dispose();
00051 
00052     /// Adds a new provider to the collection. The pointer passed to the Add method is stored. 
00053     /// Throws an invalid argument exception if the collection alreay holds a provider with the same name
00054     /// Adding a provider to the collection only adds the item to the buffered vector contained in the collection.
00055     /// The provider is not persisted beyond the collection. The collection will attempt to deallocate the provider when
00056     /// the collection is destructed.
00057     virtual void Add(FdoProvider* provider);
00058 
00059     /// Removes a provider from the collection. The allocated provider is freed. removing a provider from the 
00060     /// collection only removes the item from the buffered vector contained in the collection. The provider is not 
00061     /// removed from the persistant data store. 
00062     virtual void Remove(const wchar_t* name);
00063 /// \endcond
00064 
00065 public:
00066     /// \brief
00067     /// Gets the number of items in the collection
00068     /// 
00069     /// \return
00070     /// Returns an int containing the number of items.
00071     /// Throws an instance of FdoClientServicesException * if an error occurs.
00072     /// 
00073     FDO_API virtual int GetCount() const;
00074 
00075     /// \brief
00076     /// Gets the Provider item in the collection at the specified index. 
00077     /// 
00078     /// \param index 
00079     /// The index of the provider in the collection. The index is 0 based.
00080     /// 
00081     /// \return
00082     /// Returns an instance of an FdoProvider.
00083     /// Throws an instance of FdoClientServicesException * if the index is out of range or an error occurs.
00084     /// 
00085     FDO_API virtual FdoProvider * const GetItem(int index) const;
00086     
00087     /// \brief
00088     /// Determines if the collection contains the specified item
00089     /// 
00090     /// \param name 
00091     /// The unique name of the feature provider. This name should be of the form 
00092     /// [Company].[Provider].[Version].
00093     /// 
00094     /// \return
00095     /// Returns true if the collection contains the specified item, otherwise false.
00096     /// Throws an instance of FdoClientServicesException * if an error occurs.
00097     /// 
00098     FDO_API virtual bool Contains(const wchar_t* name) const;
00099     
00100     /// \brief
00101     /// Returns the index of the specified item in the collection.
00102     /// 
00103     /// \param name 
00104     /// The unique name of the feature provider. This name should be of the form 
00105     /// [Company].[Provider].[Version].
00106     /// 
00107     /// \return
00108     /// Returns the index item or -1 if the item does not exist. Index is 0 based.
00109     /// Throws an instance of FdoClientServicesException * if an error occurs.
00110     /// 
00111     FDO_API virtual int IndexOf(const wchar_t* name) const;
00112 
00113 private:
00114     /// The list of providers defined in the registry
00115     std::vector<FdoProvider*> m_providers;
00116 };
00117 #endif
00118 
00119 

Comments or suggestions? Send us feedback.