Example #1
0
      /* Method to fetch (as string) the first value of a given
       * variable list.
       *
       * In this context, a variable list is the same as a variable but
       * it is composed of several parts (words), separated by spaces.
       *
       * @param variableList   Variable list name.
       * @param section        Section the variable list belongs to.
       *
       * \warning This method will MODIFY the original content of
       * 'variableList'.
       */
   string ConfDataReader::fetchListValue( string variableList,
                                          string section, 
                                          string defaultVal )
      throw(ConfigurationException)
   {

      try
      {

            // Let's make sure that section and variable names are uppercase
         section      = StringUtils::upperCase(section);
         variableList = StringUtils::upperCase(variableList);

            // Store the original value of 'variableList'
         string origValue( getValue(variableList, section) );

            // Get the first word in 'originalValue'
         string firstValue( StringUtils::stripFirstWord(origValue) );

            // Modify the originalValue value
         confData[section][variableList].value = StringUtils::strip(origValue);

            // Return the first value
         string value = StringUtils::strip(firstValue);
         return ( (value=="") ? string(defaultVal) : value );

      }
      catch (ConfigurationException& e)
      {
         GPSTK_RETHROW(e);
      }

   }  // End of method 'ConfDataReader::fetchListValue()'
Example #2
0
int pop(Stack * stack)
{
    int removedElement;
    removedElement = firstValue(stack -> top);
    removeFromFront(stack -> top);
    return(removedElement);
}
Example #3
0
int peek(Stack * stack)
{
    return(firstValue(stack -> top));
}