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

ippEnumAllPropCommand.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 #include "stdafx.h"
00012 #include "ippdme/Command/ippEnumAllPropCommand.h"
00013 #include "ippdme/misc/ippStringBuilder.h"
00014 
00015 
00016 
00017 ippEnumAllPropCommand::ippEnumAllPropCommand(
00018   unsigned int tgNum, 
00019   const ippProp& prop
00020 )
00021   : ippCommand(tgNum, CommandTag, EnumAllProp)
00022   , _prop(prop)
00023 {
00024 }
00025 
00026 
00027 std::string ippEnumAllPropCommand::getCommandString() const
00028 {
00029   ippStringBuilder builder(_tag);
00030   builder.StartFunc("EnumAllProp");
00031     builder.AppendFunc(_prop.toString().c_str());
00032   builder.EndFunc();
00033   return builder.ToString();
00034 
00035 }
00036 
00037 
00038 ippEnumAllPropCommand::~ippEnumAllPropCommand()
00039 {
00040 }
00041 
00043 #include "ippdme/misc/ippPropDefinition.h"
00044 #include "ippdme/Response/ippEnumPropResponse.h"
00045 
00046 
00047 void GenerateEnumAllPropResponses(
00048   ippResponseList& responseList,
00049   unsigned int tag_num,
00050   std::string prefix,
00051   const ippPropDefinition& propDef,
00052   bool recursive
00053 )
00054 {
00055 
00056   std::string newPrefix ;
00057   if (prefix.length()) { 
00058     newPrefix.append(prefix);
00059     if (propDef._keyword!= EmptyKey) {
00060       newPrefix.append(".");
00061     }
00062   }
00063   if (propDef._keyword!= EmptyKey) {
00064     newPrefix.append(getKeyString(propDef._keyword));
00065   }
00066 
00067   if (propDef._n_properties == 0 ) {
00068     responseList.push_back(new ippEnumPropResponse(tag_num, newPrefix.c_str(), "Number"));
00069   } else {
00070     responseList.push_back(new ippEnumPropResponse(tag_num, newPrefix.c_str(), "Property"));
00071   }
00072 
00073   if (recursive) { 
00074     for (int i=0;i<propDef._n_properties;i++){
00075        const ippPropDefinition& prop = propDef._properties[i];
00076        GenerateEnumAllPropResponses(responseList,tag_num,newPrefix,prop,recursive);
00077     }
00078   } else {
00079     // only Default property has to be output
00080      for (int i=0;i<propDef._n_properties;i++){
00081        const ippPropDefinition& prop = propDef._properties[i];
00082        if (prop._keyword == EmptyKey ) { 
00083          GenerateEnumAllPropResponses(responseList,tag_num,newPrefix,prop,recursive);
00084        }
00085     }
00086  }
00087 }
00088 void GenerateEnumAllPropResponses(
00089   ippEnumAllPropCommandConstPtr& cmd,
00090   ippResponseList& responseList
00091 )
00092 {
00093    const ippProp& prop = cmd->getProp();
00094   unsigned int tag_num = cmd->getTag().getTagNumber(); 
00095 
00096   const ippPropDefinition* def =  findPropertyDefinition(prop);
00097   
00098   if (def) {
00099     for (int i=0;i<def->_n_properties;i++){
00100        const ippPropDefinition& prop = def->_properties[i];
00101        GenerateEnumAllPropResponses(responseList,tag_num,"",prop,true);
00102     }
00103   } else {
00104      // generate a error 
00105   }
00106 }
00107 
00108 
00109 #include "ippdme/Command/ippEnumPropCommand.h"
00110 void GenerateEnumPropResponses(
00111   ippEnumPropCommandConstPtr& cmd,
00112   ippResponseList& responseList
00113 )
00114 {
00115   const ippProp& prop = cmd->getProp();
00116   unsigned int tag_num = cmd->getTag().getTagNumber(); 
00117 
00118   const ippPropDefinition* def =  findPropertyDefinition(prop);
00119   
00120   if (def) {
00121     for (int i=0;i<def->_n_properties;i++){
00122        const ippPropDefinition& prop = def->_properties[i];
00123        GenerateEnumAllPropResponses(responseList,tag_num,"",prop,false);
00124     }
00125   } else {
00126      // generate a error 
00127   }
00128 }

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