Enumerating Context Groups Example for C++ 6.0 and later
int DisplayContextGroup(ILEADDicomDSPtr& spDicomDS)
{
IDicomContextGroupPtr spGroup = spDicomDS->CurrentCodedConcept;
char szMsg[256];
wsprintf(szMsg, "%s\n%s\n%s\n%04hd%02hd%02hd\n\nEnumerate Coded Concepts?",
spGroup->ContextIdentifier.operator char *(),
spGroup->Name.operator char *(),
spGroup->Extensible ? "Extensible" : "Non-extensible",
spGroup->ContextGroupVersion->Year,
spGroup->ContextGroupVersion->Month,
spGroup->ContextGroupVersion->Day);
return ::MessageBox(NULL, szMsg, "Context Group", MB_YESNOCANCEL);
}
void EnumContextGroups(ILEADDicomDSPtr& spDicomDS)
{
VARIANT_BOOL bRet;
int iRet;
spDicomDS->ResetContextGroup ();
// Load all the Context Groups
spDicomDS->LoadContextGroup ("");
// Enumerate them (3 possible ways)
#if 1
// One possible way to enumerate the Context Groups
bRet = spDicomDS->MoveFirstContextGroup();
while (bRet)
{
iRet = DisplayContextGroup(spDicomDS);
if (iRet == IDYES)
{
// Refer to Enumerating the Coded Concepts of a Context Group Example
// for C++ 6.0 and later for the function EnumCodedConcepts
EnumCodedConcepts(spDicomDS);
}
else if (iRet == IDCANCEL)
{
break;
}
bRet = spDicomDS->MoveNextContextGroup ();
}
#elif 0
// Another way to enumerate the Context Groups
long lGroupsCount = spDicomDS->GetContextGroupCount ();
for (long i = 0; i < lGroupsCount; i++)
{
spDicomDS->FindIndexContextGroup (i);
iRet = DisplayContextGroup(spDicomDS);
if (iRet == IDYES)
{
EnumCodedConcepts(spDicomDS);
}
else if (iRet == IDCANCEL)
{
break;
}
}
#elif 0
// A third way to enumerate the Context Groups
bRet = spDicomDS->MoveLastContextGroup ();
while (bRet)
{
iRet = DisplayContextGroup(spDicomDS);
if (iRet == IDYES)
{
EnumCodedConcepts(spDicomDS);
}
else if (iRet == IDCANCEL)
{
break;
}
bRet = spDicomDS->MovePrevContextGroup ();
}
#endif
}