00001 /* 00002 * The information in this file is 00003 * Copyright(c) 2007 Ball Aerospace & Technologies Corporation 00004 * and is subject to the terms and conditions of the 00005 * GNU Lesser General Public License Version 2.1 00006 * The license text is available from 00007 * http://www.gnu.org/licenses/lgpl.html 00008 */ 00009 00010 #ifndef SIMPLESIGNATURE_H__ 00011 #define SIMPLESIGNATURE_H__ 00012 00013 #include "AppConfig.h" 00014 00015 class Signature; 00016 class SignatureSet; 00017 00018 #ifdef __cplusplus 00019 extern "C" 00020 { 00021 #endif 00022 /** \addtogroup simple_api */ 00023 /*@{*/ 00024 00025 /** 00026 * @file SimpleSignature.h 00027 * This file contains API utilities for accessing signatures. 00028 */ 00029 00030 /** 00031 * Access the number of data sets in a signature. 00032 * 00033 * @param pSig 00034 * The signature DataElement to access. 00035 * @return The number of data sets in the signature. A zero may indicate failure. 00036 */ 00037 EXPORT_SYMBOL uint32_t getSignatureDataSetCount(DataElement* pSig); 00038 00039 /** 00040 * Get the name of the indexed data set. 00041 * 00042 * The index to name correspondence should not be considered static. The index 00043 * is used to access an std::set which sorted alphanumerically by name. Adding or removing 00044 * a data set to a signature may result in a reodering of the names. 00045 * 00046 * This only accesses the data names (via Signature::getDataNames()). The unit names are 00047 * not accessible but generally there are no units without a corresponding data set so this 00048 * should not cause problems. 00049 * 00050 * @param pSig 00051 * The signature DataElement to access. 00052 * @param index 00053 * The index of the data set. 00054 * @param pName 00055 * Buffer to store the name. This will be \c NULL terminated. 00056 * @param nameSize 00057 * The size of the buffer. If the name is too long, an error 00058 * will be set. 00059 * If this is 0, the minimum size of the buffer including the trailing \c NULL will be returned. 00060 * @return the actual length of the name. 00061 */ 00062 EXPORT_SYMBOL uint32_t getSignatureDataSetName(DataElement* pSig, uint32_t index, char* pName, uint32_t nameSize); 00063 00064 /** 00065 * Get the signature data set with the specified name. 00066 * 00067 * @param pSig 00068 * The signature DataElement to access. 00069 * @param pName 00070 * The \c NULL terminated name of the dataset to access. 00071 * @return The value for the named dataset. This is a shared DataVariant so freeDataVariant() should not be called. 00072 * \c NULL will be returned on error. 00073 */ 00074 EXPORT_SYMBOL DataVariant* getSignatureDataSet(DataElement* pSig, const char* pName); 00075 00076 /** 00077 * Set the signature data set with the specified name. 00078 * 00079 * @param pSig 00080 * The signature DataElement to mutate. 00081 * @param pName 00082 * The \c NULL terminated name of the dataset to mutate. 00083 * @param pValue 00084 * The DataVariant with the new value. After returning, pValue 00085 * will contain the data previously in the data set named by pName. 00086 * If the data set did not exist, pValue will be an invalid DataVariant. 00087 * @return A non-zero on error or a zero on success. 00088 */ 00089 EXPORT_SYMBOL int setSignatureDataSet(DataElement* pSig, const char* pName, DataVariant* pValue); 00090 00091 /** 00092 * Access the number of signatures in a signature set. 00093 * 00094 * @param pSet 00095 * The signature set to access. 00096 * @return The number of signatures in the signature set. A zero may indicate failure. 00097 */ 00098 EXPORT_SYMBOL uint32_t getSignatureSetCount(DataElement* pSet); 00099 00100 /** 00101 * Get the indexed signature. 00102 * 00103 * @param pSet 00104 * The signature set to access. 00105 * @param index 00106 * The index of the signature. 00107 * @return the signature as a DataElement or \c NULL on error. 00108 */ 00109 EXPORT_SYMBOL DataElement* getSignatureSetSignature(DataElement* pSet, uint32_t index); 00110 00111 /*@}*/ 00112 #ifdef __cplusplus 00113 } 00114 #endif 00115 00116 #endif