+//
+class ASDCP::MXF::Partition::h__PacketList
+{
+public:
+ std::list<InterchangeObject*> m_List;
+ std::map<UUID, InterchangeObject*> m_Map;
+
+ ~h__PacketList() {
+ while ( ! m_List.empty() )
+ {
+ delete m_List.back();
+ m_List.pop_back();
+ }
+ }
+
+ //
+ void AddPacket(InterchangeObject* ThePacket)
+ {
+ assert(ThePacket);
+ m_Map.insert(std::map<UUID, InterchangeObject*>::value_type(ThePacket->InstanceUID, ThePacket));
+ m_List.push_back(ThePacket);
+ }
+
+ //
+ Result_t GetMDObjectByID(const UUID& ObjectID, InterchangeObject** Object)
+ {
+ ASDCP_TEST_NULL(Object);
+
+ std::map<UUID, InterchangeObject*>::iterator mi = m_Map.find(ObjectID);
+
+ if ( mi == m_Map.end() )
+ {
+ *Object = 0;
+ return RESULT_FAIL;
+ }
+
+ *Object = (*mi).second;
+ return RESULT_OK;
+ }
+
+ //
+ Result_t GetMDObjectByType(const byte_t* ObjectID, InterchangeObject** Object)
+ {
+ ASDCP_TEST_NULL(ObjectID);
+ ASDCP_TEST_NULL(Object);
+ std::list<InterchangeObject*>::iterator li;
+ *Object = 0;
+
+ for ( li = m_List.begin(); li != m_List.end(); li++ )
+ {
+ if ( (*li)->HasUL(ObjectID) )
+ {
+ *Object = *li;
+ return RESULT_OK;
+ }
+ }
+
+ return RESULT_FAIL;
+ }
+
+ //
+ Result_t GetMDObjectsByType(const byte_t* ObjectID, std::list<InterchangeObject*>& ObjectList)
+ {
+ ASDCP_TEST_NULL(ObjectID);
+ std::list<InterchangeObject*>::iterator li;
+
+ for ( li = m_List.begin(); li != m_List.end(); li++ )
+ {
+ if ( (*li)->HasUL(ObjectID) )
+ ObjectList.push_back(*li);
+ }
+
+ return ObjectList.empty() ? RESULT_FAIL : RESULT_OK;
+ }
+};
+
+//------------------------------------------------------------------------------------------
+//
+
+
+ASDCP::MXF::Partition::Partition() :
+ MajorVersion(1), MinorVersion(2),
+ KAGSize(1), ThisPartition(0), PreviousPartition(0),
+ FooterPartition(0), HeaderByteCount(0), IndexByteCount(0), IndexSID(0),
+ BodyOffset(0), BodySID(0)
+{
+ m_PacketList = new h__PacketList;
+}
+
+ASDCP::MXF::Partition::~Partition()
+{
+}
+
+//
+void
+ASDCP::MXF::Partition::AddChildObject(InterchangeObject* Object)
+{
+ assert(Object);
+
+ if ( ! Object->InstanceUID.HasValue() )
+ GenRandomValue(Object->InstanceUID);
+
+ m_PacketList->AddPacket(Object);
+}
+