GME  13
CoreTerritory.cpp
Go to the documentation of this file.
00001 
00002 #include "stdafx.h"
00003 
00004 #include "CoreTerritory.h"
00005 #include "CoreProject.h"
00006 #include "CoreAttribute.h"
00007 #include "CommonCollection.h"
00008 
00009 #include <hash_set>
00010 
00011 // --------------------------- CCoreTerritory
00012 
00013 CCoreTerritory::CCoreTerritory()
00014 {
00015         status = 0;
00016 }
00017 
00018 CCoreTerritory *CCoreTerritory::Create(CCoreProject *project)
00019 {
00020         CCoreTerritory *territory = NULL;
00021 
00022         typedef CComObject< CCoreTerritory > COMTYPE;
00023         COMTHROW( COMTYPE::CreateInstance((COMTYPE **)&territory) );
00024         ASSERT( territory != NULL );
00025 
00026         territory->project = project;
00027         project->RegisterTerritory(territory);
00028 
00029         return territory;
00030 }
00031 
00032 CCoreTerritory::~CCoreTerritory()
00033 {
00034         ASSERT( project != NULL );
00035 
00036         project->UnregisterTerritory(this);
00037 
00038 #ifdef _DEBUG
00039         project = NULL;
00040 #endif
00041 }
00042 
00043 // ------- COM methods
00044 
00045 STDMETHODIMP CCoreTerritory::get_Project(ICoreProject **p)
00046 {
00047         CHECK_OUT(p);
00048 
00049         ASSERT( project != NULL );
00050         CopyTo(project, p);
00051         return S_OK;
00052 }
00053 
00054 STDMETHODIMP CCoreTerritory::get_Attributes(ICoreAttributes **p)
00055 {
00056         ASSERT(0);
00057         return E_NOTIMPL;
00058 }
00059 
00060 STDMETHODIMP CCoreTerritory::Clear()
00061 {
00062         return S_OK;
00063 }
00064