LDicomAssociate::GetUserInfoCount

#include "ltdic.h"

L_INT LDicomAssociate::GetUserInfoCount(L_VOID)

Returns the number of User-defined items in the DICOM Associate.

Returns

The number of User-defined items in the DICOM Associate.

Comments

For more information about User-defined items, refer to LDicomAssociate::AddUserInfo.

Required DLLs and Libraries

LTDIC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions:

LDicomAssociate::GetTypeUserInfo, LDicomAssociate::GetLengthUserInfo, LDicomAssociate::GetDataUserInfo, LDicomAssociate::SetUserInfo, LDicomAssociate::AddUserInfo, LDicomAssociate::DelUserInfo

Topics:

Working with DICOM Associate Connections

Example

{   
   //m_pDicomAssociate is a member variable declared as:
   //    LDicomAssociate *m_pDicomAssociate;
   int i;
   int nType;
   int nLen;
   CString cStr;
   
   //create the Associate Class as Request, and set to default
   m_pDicomAssociate = new LDicomAssociate(TRUE);
   m_pDicomAssociate->Default();
   
   //get current user info types, lengths, and data then display them
   cStr = "Current user:";
   if (m_pDicomAssociate->GetUserInfoCount() > 0) 
   {
      for (i = 0; i<m_pDicomAssociate->GetUserInfoCount(); i++)
      {
         nType = m_pDicomAssociate->GetTypeUserInfo( i);
         nLen = m_pDicomAssociate->GetLengthUserInfo( i);
         CString strData = m_pDicomAssociate->GetDataUserInfo( i);
         CString strTmp;
         strTmp.Format("Type[%d]\nLength[%d]\nData[%s]", nType, nLen,strData);
         cStr = cStr + "\n" + strTmp;
      }
   }
   else
      cStr = cStr + "\nNone";
   AfxMessageBox(cStr);
   
   //add a user info item item
   cStr = "Add user info item";
   CString strTest = "Just a test";   
   
   m_pDicomAssociate->AddUserInfo( 99, (L_CHAR *)(LPCTSTR)strTest, strTest.GetLength());
   if (m_pDicomAssociate->GetUserInfoCount() > 0) 
   {
      for (i = 0; i<m_pDicomAssociate->GetUserInfoCount(); i++)
      {
         nType = m_pDicomAssociate->GetTypeUserInfo( i);
         nLen = m_pDicomAssociate->GetLengthUserInfo( i);
         CString strData = m_pDicomAssociate->GetDataUserInfo( i);
         CString strTmp;
         strTmp.Format("Type[%d]\nLength[%d]\nData[%s]", nType, nLen,strData);
         cStr = cStr + "\n" + strTmp;
      }
   }
   else
      cStr = cStr + "\nNone";
   AfxMessageBox(cStr);
   
   
   //for each user info item, change the data
   strTest = "a second test";
   for (i = 0; i<m_pDicomAssociate->GetUserInfoCount(); i++)
   {
      nType = m_pDicomAssociate->GetTypeUserInfo( i);
      m_pDicomAssociate->SetUserInfo( i, nType, (L_CHAR *)(LPCTSTR)strTest, strTest.GetLength());
   }
   
   cStr = "Change user data";
   if (m_pDicomAssociate->GetUserInfoCount() > 0) 
   {
      for (i = 0; i<m_pDicomAssociate->GetUserInfoCount(); i++)
      {
         nType = m_pDicomAssociate->GetTypeUserInfo( i);
         nLen = m_pDicomAssociate->GetLengthUserInfo( i);
         CString strData = m_pDicomAssociate->GetDataUserInfo( i);
         CString strTmp;
         strTmp.Format("Type[%d]\nLength[%d]\nData[%s]", nType, nLen,strData);
         cStr = cStr + "\n" + strTmp;
      }
   }
   else
      cStr = cStr + "\nNone";
   AfxMessageBox(cStr);
   
   //delete the one we added
   m_pDicomAssociate->DelUserInfo( m_pDicomAssociate->GetUserInfoCount() - 1);
   cStr = "Delete the added user";
   if (m_pDicomAssociate->GetUserInfoCount() > 0) 
   {
      for (i = 0; i<m_pDicomAssociate->GetUserInfoCount(); i++)
      {
         nType = m_pDicomAssociate->GetTypeUserInfo( i);
         nLen = m_pDicomAssociate->GetLengthUserInfo( i);
         CString strData = m_pDicomAssociate->GetDataUserInfo( i);
         CString strTmp;
         strTmp.Format("Type[%d]\nLength[%d]\nData[%s]", nType, nLen,strData);
         cStr = cStr + "\n" + strTmp;
      }
   }
   else
      cStr = cStr + "\nNone";
   AfxMessageBox(cStr);
   
   //Free associate
   delete m_pDicomAssociate;
}