00001 // Torc - Copyright 2011 University of Southern California. All Rights Reserved. 00002 // $HeadURL: https://torc-isi.svn.sourceforge.net/svnroot/torc-isi/branches/staging/0.9/src/torc/generic/om/InstanceArrayMember.hpp $ 00003 // $Id: InstanceArrayMember.hpp 10 2011-10-12 18:40:16Z nsteiner $ 00004 00005 // This program is free software: you can redistribute it and/or modify it under the terms of the 00006 // GNU General Public License as published by the Free Software Foundation, either version 3 of the 00007 // License, or (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 00010 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 00011 // the GNU General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU General Public License along with this program. If 00014 // not, see <http://www.gnu.org/licenses/>. 00015 00016 #ifndef TORC_GENERIC_OM_INSTANCEARRAYMEMBER_HPP 00017 #define TORC_GENERIC_OM_INSTANCEARRAYMEMBER_HPP 00018 00019 #include "torc/generic/om/PointerTypes.hpp" 00020 #include "torc/generic/om/DumpRestoreConfig.hpp" 00021 00022 #ifdef GENOM_SERIALIZATION 00023 #include <boost/serialization/access.hpp> 00024 #endif //GENOM_SERIALIZATION 00025 00026 #include "torc/generic/util/Error.hpp" 00027 #include "torc/generic/om/FactoryType.hpp" 00028 #include "torc/generic/om/Instance.hpp" 00029 #include "torc/generic/om/VectorBit.hpp" 00030 #include "torc/generic/om/VisitorType.hpp" 00031 00032 namespace torc { namespace generic { class BaseVisitor; } } 00033 namespace torc { namespace generic { class ParameterMap; } } 00034 00035 namespace torc { 00036 00037 namespace generic { 00038 00039 /** 00040 * @brief Represents a member of an instance array. 00041 * 00042 * The InstanceArrayMember represents a single instance from an array of instances. 00043 */ 00044 class InstanceArrayMember : 00045 public Instance, 00046 public VectorBit<Instance> { 00047 #ifdef GENOM_SERIALIZATION 00048 friend class boost::serialization::access; 00049 #endif //GENOM_SERIALIZATION 00050 00051 00052 public: 00053 typedef VisitorType<InstanceArrayMember> Visitor; 00054 /** 00055 * Convenience typedef to create a parameter array element. 00056 */ 00057 typedef FactoryType<InstanceArrayMember> Factory; 00058 00059 /** 00060 * Recive a inoutVisitor to this class. The visit method of the inoutVisitor is called and a reference to this object is passed as a parameter. It has to be noted however, that a dynamic_cast is performed inside this method. If the cast fails, an appropriate exception is thrown by this method. This sitation can arise when the passed Visitor object does not inherit from the appropriate inoutVisitor specialization. See Visitor documentation for more details. 00061 * 00062 * @param[in,out] inoutVisitor A reference to the inoutVisitor object 00063 * @exception Error Visitor type inappropriate for visiting this object or any other error thrown by the Visitor::throw() method. 00064 */ 00065 virtual void 00066 accept(BaseVisitor & inoutVisitor) throw(Error); 00067 00068 /** 00069 * Returns the parent container's context that will be used to get parameters from 00070 * the parameter map. For an unbound instance, 00071 * this will return an invalid value 00072 */ 00073 virtual ParameterContext 00074 getParameterContext() const throw(); 00075 00076 /** 00077 * Get the ParameterMap corresponding to this instance and it's master 00078 * 00079 * @return A ParameterMap consisiting of only the overridden parameters. 00080 */ 00081 virtual ParameterMapSharedPtr 00082 getParameters() const throw(Error); 00083 00084 InstanceArrayMember(); 00085 virtual ~InstanceArrayMember() throw(); 00086 00087 /** 00088 * Flatten an instance so that internal references are resolved to implementation level gates for the instance 00089 */ 00090 virtual void 00091 flatten() throw(Error); 00092 00093 00094 private: 00095 #ifdef GENOM_SERIALIZATION 00096 template<class Archive> void 00097 serialize( Archive &ar, unsigned int ); 00098 #endif //GENOM_SERIALIZATION 00099 00100 }; 00101 00102 } // namespace torc::generic 00103 00104 } // namespace torc 00105 #endif // TORC_GENERIC_OM_INSTANCEARRAYMEMBER_HPP