Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ippResponse.cpp

Go to the documentation of this file.
00001 // 
00002 // DISCLAIMER: 
00003 //  This software was produced by the National Institute of Standards 
00004 //  and Technology (NIST), an agency of the U.S. government, and by statute is 
00005 //  not subject to copyright in the United States.  Recipients of this 
00006 //  software assume all responsibility associated with its operation,
00007 //  modification,maintenance, and subsequent redistribution. 
00008 //
00009 //  See NIST Administration Manual 4.09.07 b and Appendix I. 
00010 //
00011 
00012 #include "stdafx.h"
00013 #include "ippdme/Response/ippResponse.h"
00014 #include "ippdme/misc/ippStringBuilder.h"
00015 //x #include "ippdme/ippAssert.h"
00016 
00017 
00018 
00019 ippResponse::ippResponse(
00020   unsigned int inTagNumber,
00021   tagIdType inTagType,
00022   ippResponseNameType responseType
00023 )
00024 : _tag(inTagNumber, inTagType)
00025 {
00026   _responseType = responseType;
00027 }
00028 
00029 
00030 ippResponse::~ippResponse()
00031 {
00032 
00033 }
00034   
00035 void ippResponse::setResponseName(ippResponseNameType inResponseName)
00036 { 
00037   _responseType = inResponseName; 
00038 }
00039 
00040 ippResponseNameType ippResponse::getResponseName() const
00041 {
00042  return _responseType; 
00043 }
00044 
00045 const ippTag&   ippResponse::getTag() const 
00046 { 
00047   return _tag; 
00048 }
00049 
00050 /*static*/ const char * getKeyString(ippOtherKeyType  key)  
00051 { 
00052   switch(key)
00053   {
00054 #define ENUM(a,b) case a: return b;
00055     KEYWORD_ENUMERATION
00056 #undef ENUM
00057     default:
00058       return "bug";
00059   }
00060 }
00061 
00062 const char * toString(ippCoordSysType  key)  
00063 { 
00064   return getKeyString((ippOtherKeyType)key); 
00065 }
00066 
00067 
00068 const char * toString(ippChangeToolActionType  key)  
00069 { 
00070   return getKeyString(ippOtherKeyType(key)); 
00071 }
00072 
00073 ippChangeToolActionType ChangeToolActionFromKeyWord(ippOtherKeyType key)
00074 {
00075   switch(key) {
00076   case MoveAuto : return MoveAuto;
00077   case MoveMan : return MoveMan;
00078   case Rotate : return Rotate;
00079   case Switch : return Switch;
00080   }
00081   return ippChangeToolActionType_INVALID;
00082 }
00083 
00084 
00085 std::string ComposeName(
00086   ippOtherKeyType _key1,
00087   ippOtherKeyType _key2,
00088   ippOtherKeyType _key3,
00089   ippOtherKeyType _key4
00090 )
00091 {
00092   std::string r = getKeyString(_key1);
00093 
00094   if(_key2!=EmptyKey) {
00095     r+=".";
00096     r+=getKeyString(_key2);
00097 
00098     if(_key3!=EmptyKey) {
00099       r+=".";
00100       r+=getKeyString(_key3);
00101 
00102       if(_key4!=EmptyKey) {
00103         r+=".";
00104         r+=getKeyString(_key4);
00105       }
00106     }
00107   }
00108   return r;
00109 }
00110 
00111 std::string ippResponse::getResponseString() const
00112 {
00113   std::string tagString = _tag.getTagString();
00114 
00115   ippStringBuilder builder;
00116 
00117   switch(_responseType) {
00118     case Ack: {
00119       builder.Append(tagString.c_str());
00120       builder.Append(" &");
00121       return builder.ToString();
00122      } break;
00123     case Complete: {
00124       builder.Append(tagString.c_str());
00125       builder.Append(" %");
00126       return builder.ToString();
00127       }break;
00128     default:
00129   //xx    IPP_ASSERT(0);
00130       break;
00131   }
00132   return "";
00133 }
00134 

Generated on Wed Nov 8 00:20:06 2006 for IPPDME by  doxygen 1.4.1