// StreamType.cxx #include "StreamType.h" #include using std::ostream; using hes::Name; using hes::PlacementCategoryType; using hes::StreamType; typedef StreamType::PCList PCLIst; //********************************************************************** // Local definitions. //********************************************************************** namespace { // Invalid PC type. PlacementCategoryType INVALID_PCTYPE; } // end unnamed namespace //********************************************************************** // Member functions. //********************************************************************** // Default constructor. StreamType::StreamType() { } //********************************************************************** // Constructor. StreamType::StreamType(Name name, const PCList& pctypes) : m_name(name), m_pctypes(pctypes) { bool ok = m_name.is_valid() && m_pctypes.size()>0; if ( ok ) { for ( PCList::const_iterator ipct=m_pctypes.begin(); ipct!=m_pctypes.end(); ++ipct ) { if ( ! (ipct->is_valid() && ipct->is_closed()) ) { ok = false; break; } } } if ( ! ok ) { m_name = Name(); m_pctypes.erase(m_pctypes.begin(), m_pctypes.end()); } } //********************************************************************** // Is this a valid stream type? // Must have valid name and one or more PC types. bool StreamType::is_valid() const { return m_name.is_valid() && size()>0; } //********************************************************************** // Return the name. Name StreamType::name() const { return m_name; } //********************************************************************** // Return the number of PC types. int StreamType::size() const { return m_pctypes.size(); } //********************************************************************** // Return the i'th (0 =0 && i