![]() |
TAPs 0.7.7.3
|
00001 /****************************************************************************** 00002 TAPsSimulationFlags.hpp 00003 ******************************************************************************/ 00007 /****************************************************************************** 00008 SUKITTI PUNAK (09/25/2008) 00009 UPDATE (09/23/2010) 00010 ******************************************************************************/ 00011 #ifndef TAPs_SIMULATION_FLAGS_HPP 00012 #define TAPs_SIMULATION_FLAGS_HPP 00013 00020 #include "TAPsFlag.hpp" 00021 #include "../Core/TAPsEnumList.hpp" 00022 00023 BEGIN_NAMESPACE_TAPs__DS 00024 //============================================================================= 00025 class SimulationFlags { 00026 public: 00027 // Member Functions ------------------------------------------------------- 00028 00029 static const int FLAG_SIZE = 8; 00030 00032 friend std::ostream & operator<< ( std::ostream &output, SimulationFlags const &obj ) 00033 { 00034 output << obj.StrInfo(); 00035 return output; 00036 } 00037 00038 //------------------------------------------------------------------------- 00040 SimulationFlags () 00041 {} 00042 00044 SimulationFlags ( SimulationFlags const & orig ) 00045 { 00046 m_SimFlags = orig.m_SimFlags; 00047 } 00048 00050 ~SimulationFlags () 00051 {} 00052 00053 //------------------------------------------------------------------------- 00055 virtual std::string StrInfo () const 00056 { 00057 std::stringstream ss; 00058 ss << "Simulation Constraint Flags (int value " << m_SimFlags << " ):"; 00059 if ( CheckSimulationConstraints( Enum::AddOn::FIXED ) ) ss << "[FIXED: on ]"; 00060 else ss << "[FIXED: off]"; 00061 if ( CheckSimulationConstraints( Enum::AddOn::ATTACHED ) ) ss << "[ATTACHED: on ]"; 00062 else ss << "[ATTACHED: off]"; 00063 if ( CheckSimulationConstraints( Enum::AddOn::PUNCTURED ) ) ss << "[PUNCTURED: on ]"; 00064 else ss << "[PUNCTURED: off]"; 00065 if ( CheckSimulationConstraints( Enum::AddOn::SLIDABLE ) ) ss << "[SLIDABLE: on ]"; 00066 else ss << "[SLIDABLE: off]"; 00067 if ( CheckSimulationConstraints( Enum::AddOn::CLUSTERED ) ) ss << "[CLUSTERED: on ]"; 00068 else ss << "[CLUSTERED: off]"; 00069 if ( CheckSimulationConstraints( Enum::AddOn::COLLIDED ) ) ss << "[COLLIDED: on ]"; 00070 else ss << "[COLLIDED: off]"; 00071 return ss.str(); 00072 } 00073 00074 //------------------------------------------------------------------------- 00076 inline SimulationFlags & operator= ( SimulationFlags const & flags ) 00077 { 00078 m_SimFlags = flags.m_SimFlags; 00079 return *this; 00080 } 00081 00082 //------------------------------------------------------------------------- 00084 //------------------------------------------------------------------------- 00086 TAPs::DS::Flag< enum TAPs::Enum::AddOn::SimConstraints, FLAG_SIZE > & GetSimulationConstraints () 00087 { return m_SimFlags; } 00088 00090 void SetSimulationConstraints ( enum TAPs::Enum::AddOn::SimConstraints flag ) 00091 { m_SimFlags.SetFlag( flag ); } 00092 00094 void ClearSimulationConstraints ( enum TAPs::Enum::AddOn::SimConstraints flag ) 00095 { m_SimFlags.ClearFlag( flag ); } 00096 00098 bool CheckSimulationConstraints ( enum TAPs::Enum::AddOn::SimConstraints flag ) const 00099 { return m_SimFlags.CheckFlag( flag ); } 00100 00102 bool AreSimulationFlagsCleared () const 00103 { return m_SimFlags.IsCleared(); } 00104 00106 void ClearAllSimulationConstraints () 00107 { m_SimFlags.ClearAll(); } 00108 00110 void ClearAllFlags () 00111 { m_SimFlags.ClearAll(); } 00112 00113 00114 //------------------------------------------------------------------------- 00115 // Data Members ----------------------------------------------------------- 00116 //============================================================================= 00117 protected: 00118 // Member Functions ------------------------------------------------------- 00119 // Data Members ----------------------------------------------------------- 00120 TAPs::DS::Flag< enum TAPs::Enum::AddOn::SimConstraints, FLAG_SIZE > m_SimFlags; 00121 //============================================================================= 00122 private: 00123 // Member Functions ------------------------------------------------------- 00124 // Data Members ----------------------------------------------------------- 00125 //============================================================================= 00126 }; // END CLASS Flag 00127 //============================================================================= 00128 //----------------------------------------------------------------------------- 00129 //============================================================================= 00130 END_NAMESPACE_TAPs__DS 00131 //----------------------------------------------------------------------------- 00132 //#if !defined( TAPs_USE_EXPORT ) 00133 // #include "TAPsSimulationFlags.cpp" 00134 //#endif 00135 //----------------------------------------------------------------------------- 00136 #endif 00137 //34567890123456789012345678901234567890123456789012345678901234567890123456789 00138 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----