You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by ea...@apache.org on 2007/02/03 17:58:56 UTC

svn commit: r503251 [10/13] - /incubator/uima/uimacpp/trunk/src/framework/uima/

Added: incubator/uima/uimacpp/trunk/src/framework/uima/taespecifier.hpp
URL: http://svn.apache.org/viewvc/incubator/uima/uimacpp/trunk/src/framework/uima/taespecifier.hpp?view=auto&rev=503251
==============================================================================
--- incubator/uima/uimacpp/trunk/src/framework/uima/taespecifier.hpp (added)
+++ incubator/uima/uimacpp/trunk/src/framework/uima/taespecifier.hpp Sat Feb  3 08:58:54 2007
@@ -0,0 +1,1141 @@
+/** \file taespecifier.hpp .
+-----------------------------------------------------------------------------
+
+
+
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+
+-----------------------------------------------------------------------------
+
+    \brief Contains uima::FSIndexKeyDescription, uima::FSIndexDescription, uima::AnalysisEngineMetaData uima::AnalysisEngineDescription etc.
+
+   Description: Resource Specifier Classes for Text Analysis Engines
+
+-----------------------------------------------------------------------------
+
+
+   01/30/2003  Initial creation
+
+-------------------------------------------------------------------------- */
+#ifndef UIMA_TAESPECIFIER_HPP
+#define UIMA_TAESPECIFIER_HPP
+// ---------------------------------------------------------------------------
+//  Includes
+// ---------------------------------------------------------------------------
+
+#include "uima/pragmas.hpp" //must be first to surpress warnings
+#include "uima/err_ids.h"
+
+#include "uima/taemetadata.hpp"
+#include "uima/typesystemdescription.hpp"
+#include "uima/capability.hpp"
+#include "uima/config_param.hpp"
+
+#include "uima/sofamapping.hpp"
+
+#include <list>
+#include <map>
+
+namespace uima {
+  class ConfigurationDescription;
+
+  UIMA_EXC_CLASSDECLARE(ConfigParamLookupException, ConfigException);
+
+
+
+
+  /**
+  * Contains the description of an index key, i.e. the feature name
+  * and the comparator that should be used when comparing the feature
+  **/
+  class UIMA_LINK_IMPORTSPEC FSIndexKeyDescription : public MetaDataObject {
+  public:
+    FSIndexKeyDescription()
+        :iv_featureName(), iv_comparator(STANDARD), iv_bIsTypePriority(false) {}
+
+    enum EnComparatorType {
+      STANDARD, REVERSE
+    };
+
+    TyErrorId setFeatureName(const icu::UnicodeString & feature) {
+      if (! isModifiable()) {
+        return UIMA_ERR_CONFIG_OBJECT_COMITTED;
+      }
+      iv_featureName = feature;
+      return UIMA_ERR_NONE;
+    }
+
+    const icu::UnicodeString & getFeatureName() const {
+      return(iv_featureName);
+    }
+
+    TyErrorId setComparator(EnComparatorType comp) {
+      if (! isModifiable()) {
+        return UIMA_ERR_CONFIG_OBJECT_COMITTED;
+      }
+      iv_comparator = comp;
+      return UIMA_ERR_NONE;
+    }
+
+    EnComparatorType getComparator() const {
+      return(iv_comparator);
+    }
+
+    TyErrorId setIsTypePriority() {
+      if (! isModifiable()) {
+        return UIMA_ERR_CONFIG_OBJECT_COMITTED;
+      }
+      iv_bIsTypePriority = true;
+      return UIMA_ERR_NONE;
+    }
+
+    bool isTypePriority() const {
+      return iv_bIsTypePriority;
+    }
+
+  private:
+    icu::UnicodeString iv_featureName;
+    EnComparatorType iv_comparator;
+    bool iv_bIsTypePriority;
+  };
+
+  /**
+  * Defines an index for a specific type. Is identified
+  * by its unique label. Contains a vector of index keys that
+  * define the features of the type that should be used in the index
+  * @see FSIndexKeyDescription
+  **/
+  class  UIMA_LINK_IMPORTSPEC FSIndexDescription : public MetaDataObject {
+  public:
+    typedef vector < FSIndexKeyDescription * > TyVecpFSIndexKeys;
+    enum EnIndexKind {
+      SORTED, BAG, SET
+    };
+
+    FSIndexDescription()
+        :MetaDataObject(), iv_label(), iv_typeName(), iv_kind(SORTED), iv_keys() {}
+
+    ~FSIndexDescription() {
+      size_t i;
+      for (i=0; i < iv_keys.size(); i++) {
+        delete iv_keys[i];
+      }
+    }
+
+    TyErrorId setLabel(const icu::UnicodeString & name) {
+      if (! isModifiable()) {
+        return UIMA_ERR_CONFIG_OBJECT_COMITTED;
+      }
+      iv_label = name;
+      return UIMA_ERR_NONE;
+    }
+
+    const icu::UnicodeString & getLabel() const {
+      return(iv_label);
+    }
+
+    TyErrorId setTypeName(const icu::UnicodeString & name) {
+      if (! isModifiable()) {
+        return UIMA_ERR_CONFIG_OBJECT_COMITTED;
+      }
+      iv_typeName = name;
+      return UIMA_ERR_NONE;
+    }
+
+    const icu::UnicodeString & getTypeName() const {
+      return(iv_typeName);
+    }
+
+    TyErrorId setIndexKind(EnIndexKind kind) {
+      if (! isModifiable()) {
+        return UIMA_ERR_CONFIG_OBJECT_COMITTED;
+      }
+      iv_kind = kind;
+      return UIMA_ERR_NONE;
+    }
+
+    EnIndexKind getIndexKind() const {
+      return iv_kind;
+    }
+    /**
+    * NOTE: This object will assume memory ownership of <code>desc</code>,
+    * i.e. it will delete it when destroyed!
+    **/
+    TyErrorId addFSIndexKey(FSIndexKeyDescription * desc) {
+      if (! isModifiable()) {
+        return UIMA_ERR_CONFIG_OBJECT_COMITTED;
+      }
+      iv_keys.push_back(desc);
+      return UIMA_ERR_NONE;
+    }
+
+    const TyVecpFSIndexKeys & getFSIndexKeys() const {
+      return iv_keys;
+    }
+
+    void commit() {
+      size_t i;
+      for (i=0; i < iv_keys.size(); i++) {
+        iv_keys[i]->commit();
+      }
+      iv_bIsModifiable = false;
+    }
+
+
+  private:
+    FSIndexDescription(const FSIndexDescription & crOther);
+
+    FSIndexDescription & operator=(FSIndexDescription const & crOther);
+
+    icu::UnicodeString iv_label;
+    icu::UnicodeString iv_typeName;
+    EnIndexKind iv_kind;
+    TyVecpFSIndexKeys iv_keys;
+  };
+
+
+
+  /**
+  * Specifies the order in which Annotators are invoked.
+  * The sequence is given by the order in which <code>addNode</code>
+  * was called.
+  **/
+  class  UIMA_LINK_IMPORTSPEC FlowConstraints : public MetaDataObject {
+  public:
+
+    enum EnFlowType {
+      FIXED, CAPABILITYLANGUAGE
+    };
+
+
+    /**
+    * <code>node</code> must uniquely identify an annotator.
+    **/
+    virtual EnFlowType const & getFlowConstraintsType()=0;
+    virtual  vector < icu::UnicodeString > const & getNodes() const = 0;
+    virtual TyErrorId addNode(const icu::UnicodeString & node)=0;
+
+  };
+
+
+  /**
+  * Specifies the order in which Annotators are invoked.
+  * The sequence is given by the order in which <code>addNode</code>
+  * was called.
+  **/
+  class  UIMA_LINK_IMPORTSPEC FixedFlow : public FlowConstraints {
+  public:
+    FixedFlow()
+        :FlowConstraints(), iv_type(FIXED), iv_nodes() {}
+    EnFlowType const & getFlowConstraintsType() {
+      return iv_type;
+    }
+    /**
+    * <code>node</code> must uniquely identify an annotator.
+    **/
+    TyErrorId addNode(const icu::UnicodeString & node) {
+      if (! isModifiable()) {
+        return UIMA_ERR_CONFIG_OBJECT_COMITTED;
+      }
+      iv_nodes.push_back(node);
+      return UIMA_ERR_NONE;
+    }
+
+    vector < icu::UnicodeString > const & getNodes() const {
+      return(iv_nodes);
+    }
+  private:
+    EnFlowType iv_type;
+    vector<icu::UnicodeString> iv_nodes;
+  };
+
+  class  UIMA_LINK_IMPORTSPEC CapabilityLanguageFlow : public FlowConstraints {
+  public:
+    CapabilityLanguageFlow()
+        :FlowConstraints(),  iv_type(CAPABILITYLANGUAGE), iv_nodes() {}
+    EnFlowType const & getFlowConstraintsType() {
+      return iv_type;
+    }
+    /**
+    * <code>node</code> must uniquely identify an annotator.
+    **/
+    TyErrorId addNode(const icu::UnicodeString & node) {
+      if (! isModifiable()) {
+        return UIMA_ERR_CONFIG_OBJECT_COMITTED;
+      }
+      iv_nodes.push_back(node);
+      return UIMA_ERR_NONE;
+    }
+
+    vector < icu::UnicodeString > const & getNodes() const {
+      return(iv_nodes);
+    }
+  private:
+    EnFlowType iv_type;
+    vector<icu::UnicodeString> iv_nodes;
+  };
+
+
+
+
+
+
+
+  /**
+   * Contains the <code>MetaDataObject</code>s that are defined for both
+   * delegate and aggregate <code>TextAnalysisEngine</code>s,
+   * for example the description of the types used and the capabilities
+   * of the TAE.
+   * Normally, applications and annotators don't deal with the
+   * <code>AnalysisEngineMetaData</code> directly.
+   * They should use the methods on the <code>AnnotatorContext</code>.
+   *
+   * @see AnalysisEngineDescription
+   */
+  class  UIMA_LINK_IMPORTSPEC AnalysisEngineMetaData :public MetaDataObject {
+  public:
+    friend class XMLParser;
+    friend class AnalysisEngineDescription;
+    friend class AnnotatorContext;
+
+    enum EnSearchStrategy {
+      NONE, DEFAULT_FALLBACK, LANGUAGE_FALLBACK
+    };
+
+    typedef vector <Capability *> TyVecpCapabilities;
+    typedef vector <FSIndexDescription *> TyVecpFSIndexDescriptions;
+    typedef vector<TypePriority *> TyVecpTypePriorities;
+
+    typedef vector<ImportDescription *> TyVecpFSIndexImportDescriptions;
+    typedef vector<ImportDescription *> TyVecpTypePriorityImportDescriptions;
+
+    typedef map <icu::UnicodeString, ConfigurationGroup> TyConfigGroup;
+    typedef map <icu::UnicodeString, SettingsForGroup> TyConfigSettings;
+
+
+    AnalysisEngineMetaData()
+        :MetaDataObject(), CONFIG_GROUP_NAME_WHEN_NO_GROUPS("CONFIG_GROUP_NAME_WHEN_NO_GROUPS"),
+        CONFIG_GROUP_NAME_COMMON_PARMS("CONFIG_GROUP_NAME_COMMON_PARAMETERS"),
+        iv_hasGroups(false), iv_hasDefaultGroup(false), iv_searchStrategy(NONE),
+        iv_pTypeSystemDesc(NULL), iv_pFlowConstraints(NULL), iv_vecpTypePriorities() {}
+
+    ~AnalysisEngineMetaData();
+
+	void validate();
+    void commit();
+
+    /**
+    * NOTE: This object will assume memory ownership of <code>flowConstraint</code>, i.e.
+    * it will be deleted when this object's destructor is called !
+    **/
+    TyErrorId setFlowConstraints(FlowConstraints * flow) {
+      if (! isModifiable()) {
+        return UIMA_ERR_CONFIG_OBJECT_COMITTED;
+      }
+      iv_pFlowConstraints = flow;
+      return UIMA_ERR_NONE;
+    }
+
+    FlowConstraints * getFlowConstraints() {
+      return(iv_pFlowConstraints);
+    }
+
+    FlowConstraints  const * getFlowConstraints() const {
+      return(iv_pFlowConstraints);
+    }
+
+
+    FlowConstraints::EnFlowType const & getFlowConstraintsType() {
+      return iv_pFlowConstraints->getFlowConstraintsType();
+    }
+
+
+    TyErrorId setName(const icu::UnicodeString & name) {
+      if (! isModifiable()) {
+        return UIMA_ERR_CONFIG_OBJECT_COMITTED;
+      }
+      iv_name = name;
+      return UIMA_ERR_NONE;
+    }
+
+    const icu::UnicodeString & getName() const {
+      return(iv_name);
+    }
+
+    TyErrorId setDescription(const icu::UnicodeString & desc) {
+      if (! isModifiable()) {
+        return UIMA_ERR_CONFIG_OBJECT_COMITTED;
+      }
+      iv_description = desc;
+      return UIMA_ERR_NONE;
+    }
+
+    const icu::UnicodeString & getDescription() const {
+      return(iv_description);
+    }
+
+    TyErrorId setVersion(const icu::UnicodeString & version) {
+      if (! isModifiable()) {
+        return UIMA_ERR_CONFIG_OBJECT_COMITTED;
+      }
+      iv_version = version;
+      return UIMA_ERR_NONE;
+    }
+
+    const icu::UnicodeString & getVersion() const {
+      return(iv_version);
+    }
+
+    TyErrorId setVendor(const icu::UnicodeString & vendor) {
+      if (! isModifiable()) {
+        return UIMA_ERR_CONFIG_OBJECT_COMITTED;
+      }
+      iv_vendor = vendor;
+      return UIMA_ERR_NONE;
+    }
+
+    const icu::UnicodeString & getVendor() const {
+      return(iv_vendor);
+    }
+
+    /**
+    * Side effect: creates a configuration group <code>groupName</code>,
+    * if it doesn't exist already.
+    * Reason: otherwise, <code>AnnotatorContext</code>`s <code>assignValue</code>
+    * with two parameters will fail if the specifier defines all parameters in the
+    * <code>commonParameters</code> section and declares the default group only via
+    * the <code>defaultGroup</code> attribute of <code>configurationParameters</code>
+    **/
+    TyErrorId setDefaultGroupName(const icu::UnicodeString & groupName);
+
+    bool hasDefaultGroup() const {
+      return iv_hasDefaultGroup;
+    }
+
+    bool hasGroups() const {
+      return iv_hasGroups;
+    }
+
+    TyErrorId setSearchStrategy(EnSearchStrategy strategy) {
+      if (! isModifiable()) {
+        return UIMA_ERR_CONFIG_OBJECT_COMITTED;
+      }
+      iv_searchStrategy = strategy;
+      return UIMA_ERR_NONE;
+    }
+
+    EnSearchStrategy getSearchStrategy() const {
+      return(iv_searchStrategy);
+    }
+
+    /**
+    * NOTE: This object will assume memory ownership of <code>desc</code>, i.e.
+    * it will be deleted when this object's destructor is called !
+    **/
+    TyErrorId setTypeSystemDescription(TypeSystemDescription * desc) {
+      if (! isModifiable()) {
+        return UIMA_ERR_CONFIG_OBJECT_COMITTED;
+      }
+      iv_pTypeSystemDesc = desc;
+      return UIMA_ERR_NONE;
+    }
+
+    TypeSystemDescription * getTypeSystemDescription() {
+      return(iv_pTypeSystemDesc);
+    }
+
+    TypeSystemDescription const * getTypeSystemDescription() const {
+      return(iv_pTypeSystemDesc);
+    }
+
+    /**
+    * NOTE: This object will assume memory ownership of <code>prio</code>,
+    * i.e. it will delete it when destroyed !
+    **/
+    TyErrorId addTypePriority(TypePriority * prio);
+
+    const TyVecpTypePriorities & getTypePriorities() const {
+      return iv_vecpTypePriorities;
+    }
+
+    /**
+    * @return A group name <code>g</code> for which the following holds true:
+    * The behavior of <code>getNameValuePair(param)</code> and
+    * <code>getNameValuePair(g, param, getSearchStrategy())</code> is
+    * the same.
+    * If a default group is defined, returns that group name.
+    * If no groups are defined, returns CONFIG_GROUP_NAME_WHEN_NO_GROUPS.
+    * If groups are defined, but no default group, throws an exception.
+    **/
+    const icu::UnicodeString & getGroupNameWhenNotSpec() const;
+
+    /**
+    * return a reference to the NameValuePair whose name is paramName
+    * iff
+    * a) there are no configuration groups defined or there is a default group defined.
+    * b) a NameValuePair with the name exists in the configuration settings of this taespecifier
+    *
+    * Otherwise, return NULL
+    **/
+    NameValuePair * getNameValuePair(const icu::UnicodeString & paramName,
+                                     const icu::UnicodeString & ancKey="");
+
+    /**
+    * returns a reference to the NameValuePair whose name is paramName
+    * iff
+    * a) there are configuration groups defined
+    * b) a NameValuePair with the name exists in the configuration settings
+    *    of the 'appropriate' group. This group may either be groupName or one of the fallback
+    *    groups specified by the searchStrategy and defaultGroup
+    *
+    * Otherwise, return NULL
+    **/
+    NameValuePair * getNameValuePair(const icu::UnicodeString & groupName,
+                                     const icu::UnicodeString & paramName,
+                                     EnSearchStrategy strategy,
+                                     const icu::UnicodeString & ancKey="");
+
+    /**
+    * TyErrorId == UIMA_ERR_NONE iff
+    * a) there are groups: the name of nvPair is a configuration parameter defined
+    *    in the common parameters or in the default group
+    * b) there are no groups:  the name of nvPair is a configuration parameter
+    * If above conditions hold true, nvPair will be added to
+    * a) the settings of the default group
+    * b) the configuration settings
+    **/
+    TyErrorId setNameValuePair(const NameValuePair & nvPair) {
+      if (hasGroups()) {
+        return setNameValuePair(getDefaultGroupName(), nvPair);
+      } else {
+        return setNameValuePair(CONFIG_GROUP_NAME_WHEN_NO_GROUPS, nvPair);
+      }
+    }
+
+    /**
+    * TyErrorId == UIMA_ERR_NONE iff
+    * a) there is a group groupName in the configuration parameters
+    * b) the name of nvPair is a configuration parameter defined in groupName
+    **/
+    TyErrorId setNameValuePair(const icu::UnicodeString & groupName,
+                               const NameValuePair & nvPair);
+
+
+    /**
+     * Returns true iff the parameter paramName is defined
+     */
+    bool isParameterDefined(const icu::UnicodeString & paramName,
+                            const icu::UnicodeString & ancKey) const;
+
+    /**
+     * returns TRUE iff paramName is either defined for group groupName
+     * or in the commonParameter section
+     **/
+    bool isParameterDefined(const icu::UnicodeString & groupName,
+                            const icu::UnicodeString & paramName,
+                            const icu::UnicodeString & ancKey) const;
+
+    /**
+    * NOTE: This object will assume memory ownership of <code>flow</code>, i.e.
+    * it will be deleted when this object's destructor is called !
+    **/
+    TyErrorId setFixedFlow(FixedFlow * flow) {
+      if (! isModifiable()) {
+        return UIMA_ERR_CONFIG_OBJECT_COMITTED;
+      }
+      iv_pFlowConstraints = flow;
+      return UIMA_ERR_NONE;
+    }
+
+    FixedFlow * getFixedFlow() {
+      if (iv_pFlowConstraints->getFlowConstraintsType() == FlowConstraints::FIXED ) {
+        return((FixedFlow*)iv_pFlowConstraints);
+      } else return NULL;
+    }
+
+    FixedFlow const * getFixedFlow() const {
+      if (iv_pFlowConstraints->getFlowConstraintsType() == FlowConstraints::FIXED ) {
+        return((FixedFlow*)iv_pFlowConstraints);
+      } else return NULL;
+    }
+
+
+
+
+
+    /**
+    * NOTE: This object will assume memory ownership of <code>capability</code>, i.e.
+    * it will be deleted when this object's destructor is called !
+    **/
+    TyErrorId addCapability(Capability * capability) {
+      if (! isModifiable()) {
+        return UIMA_ERR_CONFIG_OBJECT_COMITTED;
+      }
+      iv_capabilities.push_back(capability);
+      return UIMA_ERR_NONE;
+    }
+
+    const TyVecpCapabilities & getCapabilites() const {
+      return iv_capabilities;
+    }
+
+    /**
+    * NOTE: This object will assume memory ownership of <code>indexDesc</code>, i.e.
+    * it will be deleted when this object's destructor is called !
+    **/
+    TyErrorId addFSIndexDescription(FSIndexDescription * indexDesc) {
+      if (! isModifiable()) {
+        return UIMA_ERR_CONFIG_OBJECT_COMITTED;
+      }
+      iv_indexDescs.push_back(indexDesc);
+      return UIMA_ERR_NONE;
+    }
+
+    const TyVecpFSIndexDescriptions & getFSIndexDescriptions() const {
+      return iv_indexDescs;
+    }
+
+    /**
+      * NOTE: This object will assume memory ownership of <code>importDescription</code>, i.e.
+      * it will be deleted when this object's destructor is called !
+      **/
+    TyErrorId addFSIndexImportDescription(ImportDescription * importDesc, bool & takesMemoryOwnership) {
+      takesMemoryOwnership=false;
+      if (! isModifiable()) {
+        return UIMA_ERR_CONFIG_OBJECT_COMITTED;
+      }
+      iv_fsindexImportDescs.push_back(importDesc);
+      takesMemoryOwnership=true;
+      return UIMA_ERR_NONE;
+    }
+
+    const TyVecpFSIndexImportDescriptions & getFSIndexImportDescriptions() const {
+      return iv_fsindexImportDescs;
+    }
+
+
+
+    /**
+     * NOTE: This object will assume memory ownership of <code>importDescription</code>, i.e.
+     * it will be deleted when this object's destructor is called !
+     **/
+    TyErrorId addTypePriorityImportDescription(ImportDescription * importDesc,bool & takesMemoryOwnership) {
+      takesMemoryOwnership=false;
+
+      if (! isModifiable()) {
+        return UIMA_ERR_CONFIG_OBJECT_COMITTED;
+      }
+      iv_typepriorityImportDescs.push_back(importDesc);
+      takesMemoryOwnership=true;
+      return UIMA_ERR_NONE;
+    }
+
+    const TyVecpTypePriorityImportDescriptions & getTypePriorityDescriptions() const {
+      return iv_typepriorityImportDescs;
+    }
+
+
+
+
+
+    /**
+    * @return The names of all groups in this specifier that define <code>paramName</code>.
+    * May contain duplicate group names.
+    **/
+    const vector < icu::UnicodeString > getGroupNamesForParameter(const icu::UnicodeString & paramName) const;
+
+
+  private:
+    AnalysisEngineMetaData(AnalysisEngineMetaData const & crOther);
+
+    AnalysisEngineMetaData & operator=(AnalysisEngineMetaData const & crOther);
+
+    const icu::UnicodeString & getDefaultGroupName() const {
+      return(iv_defaultGroup);
+    }
+
+    /**
+    * To be used only when there are no configuration groups defined
+    **/
+    /*       NameValuePair * getNameValuePairPtr(const icu::UnicodeString & paramName) {  */
+    /*          return(getNameValuePairPtr(CONFIG_GROUP_NAME_WHEN_NO_GROUPS, paramName)); */
+    /*       }                                                                            */
+
+
+    /**
+    * returns a pointer to the NameValuePair whose name is paramName
+    * iff
+    * a) there are configuration groups defined
+    * b) a NameValuePair with the name exists in the configuration settings
+    *    of this group
+    * Otherwise, return NULL
+    **/
+    NameValuePair * getNameValuePairPtr(const icu::UnicodeString & groupName,
+                                        const icu::UnicodeString & paramName);
+
+    /**
+    * returns a pointer to the NameValuePair whose name is paramName
+    * iff
+    * a NameValuePair with the name exists in the configuration settings
+    *    of this group
+    * Throws an exception if a value exists, but <code>paramName</code> is not
+    * defined in the configuration parameters.
+    * Otherwise, return NULL
+    * @see TextAnalysisEngineSpecifierBuilder
+    **/
+    NameValuePair * getNameValuePairNoFallback(const icu::UnicodeString & groupName,
+        const icu::UnicodeString & paramName,
+        const icu::UnicodeString & ancKey);
+    /**
+    * Generates all possible fallback groups for groupName, depending on strategy.
+    * Not all of these groups may exist in the configuration settings.
+    **/
+    void generateFallbackGroups(const icu::UnicodeString & groupName,
+                                EnSearchStrategy strategy,
+                                vector < icu::UnicodeString> & fallbackGroups);
+
+    /**
+    * Adds a configuration group named <code>groupName</code>.
+    * Throws an exception if the group already exists
+    **/
+    TyErrorId addConfigurationGroup(const icu::UnicodeString & groupName);
+
+    /**
+    * NOTE: This object will assume memory ownership of <code>param</code>, i.e.
+    * it will be deleted when this object's destructor is called !
+    **/
+    TyErrorId addCommonParameter(ConfigurationParameter * param) {
+      return addConfigurationParameter(CONFIG_GROUP_NAME_COMMON_PARMS, param);
+    }
+
+    /**
+    * NOTE: This object will assume memory ownership of <code>param</code>, i.e.
+    * it will be deleted when this object's destructor is called !
+    **/
+    TyErrorId addConfigurationParameter(ConfigurationParameter * param) {
+      return addConfigurationParameter(CONFIG_GROUP_NAME_WHEN_NO_GROUPS, param);
+    }
+
+    /**
+    * NOTE: This object will assume memory ownership of <code>param</code>, i.e.
+    * it will be deleted when this object's destructor is called !
+    **/
+    TyErrorId addConfigurationParameter(const icu::UnicodeString & groupName,
+                                        ConfigurationParameter * param);
+
+    /**
+    * NOTE: This object will assume memory ownership of <code>nvPair</code>, i.e.
+    * it will be deleted when this object's destructor is called !
+    + Throws a <code>ConfigParamLookupException</code> if the parameter is not defined .
+    **/
+    void addNameValuePair(NameValuePair * nvPair) {
+      addNameValuePair(CONFIG_GROUP_NAME_WHEN_NO_GROUPS, nvPair);
+    }
+
+    /**
+    * NOTE: This object will assume memory ownership of <code>nvPair</code>, i.e.
+    * it will be deleted when this object's destructor is called !
+    + Throws a <code>ConfigParamLookupException</code> if the parameter is not defined
+    * for the group.
+    **/
+    void addNameValuePair(const icu::UnicodeString & groupName,
+                          NameValuePair * nvPair);
+
+    /**
+    * @return The names of all groups defined in this <code>AnalysisEngineMetaData</code>
+    * object. If there are no groups defined, the vector contains only one entry,
+    * <code>CONFIG_GROUP_NAME_WHEN_NO_GROUPS</code>. To be used together with
+    * <code>getConfigurationParameters</code> to obtain all configuration parameters defined
+    * in this <code>AnalysisEngineMetaData</code>.
+    * Note: <code>CONFIG_GROUP_NAME_COMMON_PARMS</code> is never contained in the vector.
+    * These parameters will be added explicitly in the calls to <code>getConfigurationParameters</code>.
+    * 
+    **/
+    const vector <icu::UnicodeString> getConfigurationGroupNames() const;
+
+    /**
+    * @return All <code>ConfigurationParameter</code>s defined for <code>groupName</code>.
+    * If there are parameters defined in the commonParameters section, they will be returned
+    * as well.
+    * Returns an empty vector if <code>groupName</code> does not exist.
+    **/
+    const vector <const ConfigurationParameter *> getConfigurationParameters(const icu::UnicodeString & groupName) const;
+
+
+    //internally, we store configuration parameters and settings always in groups
+    //this is the group name we use when there are no groups defined
+    icu::UnicodeString CONFIG_GROUP_NAME_WHEN_NO_GROUPS;
+    //internally, the common parameters are just another configuration group
+    icu::UnicodeString CONFIG_GROUP_NAME_COMMON_PARMS;
+
+    //typedef map <icu::UnicodeString, ConfigurationGroup> TyConfigGroup;
+    //typedef map <icu::UnicodeString, SettingsForGroup> TyConfigSettings;
+    icu::UnicodeString iv_name;
+    icu::UnicodeString iv_description;
+    icu::UnicodeString iv_version;
+    icu::UnicodeString iv_vendor;
+    icu::UnicodeString iv_defaultGroup;
+    bool iv_hasGroups;
+    bool iv_hasDefaultGroup;
+    EnSearchStrategy iv_searchStrategy;
+    TyConfigGroup iv_configurationGroups;
+    TyConfigSettings iv_configurationSettings;
+    TypeSystemDescription * iv_pTypeSystemDesc;
+    FlowConstraints * iv_pFlowConstraints;
+    TyVecpCapabilities iv_capabilities;
+    TyVecpFSIndexDescriptions iv_indexDescs;
+    TyVecpTypePriorities iv_vecpTypePriorities;
+
+    TyVecpFSIndexImportDescriptions iv_fsindexImportDescs;
+    TyVecpTypePriorityImportDescriptions iv_typepriorityImportDescs;
+
+
+  };
+
+  /**
+  * Contains all <code>MetaDataObject</code>s for a particular TextAnalysisEngine
+  * that are found in a TextAnalysisEngine Resource Specifier XML file.
+  * In case of an aggregate TAE, the <code>AnalysisEngineDescription</code> contains
+  * all <code>AnalysisEngineDescription</code>s of the delegate TAEs when it is built by
+  * the <code>TextAnalysisEngineSpecifierBuilder</code>. However, these delegate specifiers are removed
+  * when the <code>AnnotatorContext</code> for the TAE is built.
+  * Normally, applications and annotators don't deal with the <code>AnalysisEngineDescription</code> directly.
+  * They should use the methods on the <code>AnnotatorContext</code>.
+  * @see AnnotatorContext
+  **/
+  class  UIMA_LINK_IMPORTSPEC AnalysisEngineDescription : public MetaDataObject {
+  public:
+    friend class XMLParser;
+	friend class TextAnalysisEngineSpecifierBuilder; 
+    friend class CasDefinition;
+
+    typedef std::map<icu::UnicodeString, AnalysisEngineDescription *> TyMapDelegateSpecs;
+    typedef vector <SofaMapping *> TyVecpSofaMappings;
+
+    enum EnFrameworkImplName {
+      CPLUSPLUS, JAVA
+    };
+
+    AnalysisEngineDescription()
+        :MetaDataObject(), iv_bPrimitive(false), iv_enFrameImpl(CPLUSPLUS),
+        iv_annotatorImpName(), iv_xmlFileLoc(), iv_pAeMetaData(NULL) {
+      iv_pMapDelegateSpecifiers = new TyMapDelegateSpecs();
+    }
+
+
+    ~AnalysisEngineDescription() {
+      TyMapDelegateSpecs::iterator entries = iv_pMapDelegateSpecifiers->begin();
+      while (entries != iv_pMapDelegateSpecifiers->end()) {
+        delete (*entries).second;
+        entries++;
+      }
+      delete iv_pMapDelegateSpecifiers;
+      delete iv_pAeMetaData;
+      //BSI
+      size_t i;
+      for (i=0; i < iv_SofaMappings.size(); i++) {
+        delete   iv_SofaMappings[i];
+      }
+
+    }
+    void validate();
+    void commit();
+
+    /**
+    * NOTE: This object will assume memory ownership of <code>metaData</code>, i.e.
+    * it will be deleted when this object's destructor is called !
+    **/
+    TyErrorId setAnalysisEngineMetaData(AnalysisEngineMetaData * metaData) {
+      if (! isModifiable()) {
+        return UIMA_ERR_CONFIG_OBJECT_COMITTED;
+      }
+      iv_pAeMetaData = metaData;
+      return UIMA_ERR_NONE;
+    }
+
+    AnalysisEngineMetaData * getAnalysisEngineMetaData() {
+      return(iv_pAeMetaData);
+    }
+
+    AnalysisEngineMetaData const * getAnalysisEngineMetaData() const {
+      return(iv_pAeMetaData);
+    }
+
+    /**
+    * return the search strategy that is applied when looking for configuration parameter values
+    **/
+    AnalysisEngineMetaData::EnSearchStrategy getSearchStrategy() const {
+      return iv_pAeMetaData->getSearchStrategy();
+    }
+
+    TyErrorId setPrimitive(bool primitive) {
+      if (! isModifiable()) {
+        return UIMA_ERR_CONFIG_OBJECT_COMITTED;
+      }
+      iv_bPrimitive = primitive;
+      return UIMA_ERR_NONE;
+    }
+
+
+    bool isPrimitive() const {
+      return iv_bPrimitive;
+    }
+
+    EnFrameworkImplName getFrameworkImplName() const {
+      return iv_enFrameImpl;
+    }
+
+
+    /**
+    * Returns a meaningful value only if isPrimitive() == true
+    **/
+    const icu::UnicodeString & getAnnotatorImpName() const {
+      return iv_annotatorImpName;
+    }
+
+    void setXmlFileLocation(const icu::UnicodeString xmlLoc) {
+      iv_xmlFileLoc = xmlLoc;
+    }
+
+    /**
+    * @return The full path name of the XML file used to build up this
+    * AnalysisEngineDescription. If it was built from a memory buffer,
+    * returns some buffer ID generated by Xerces
+    */
+    const icu::UnicodeString & getXmlFileLocation() const {
+      return iv_xmlFileLoc;
+    }
+
+    void setXmlRootTag(const icu::UnicodeString xmlTag) {
+      iv_xmlRootTag = xmlTag;
+    }
+
+    /**
+    * @return The full path name of the XML file used to build up this
+    * AnalysisEngineDescription. If it was built from a memory buffer,
+    * returns some buffer ID generated by Xerces
+    */
+    const icu::UnicodeString & getXmlRootTag() const {
+      return iv_xmlRootTag;
+    }
+
+    /**
+    * NOTE: This object will assume memory ownership of <code>taeSpec</code>, i.e.
+    * it will be deleted when this object's destructor is called !
+    **/
+    TyErrorId addDelegate(const icu::UnicodeString & key,
+                          AnalysisEngineDescription * taeSpec) {
+      if (! isModifiable()) {
+        return UIMA_ERR_CONFIG_OBJECT_COMITTED;
+      }
+      (*iv_pMapDelegateSpecifiers)[key] = taeSpec;
+      return UIMA_ERR_NONE;
+    }
+
+    /**
+    * Note: This object will still assume memory ownership of the AnalysisEngineDescription
+    * that are returned.
+    **/
+    const TyMapDelegateSpecs & getDelegates() const {
+      return *iv_pMapDelegateSpecifiers;
+    }
+
+
+
+    /** BSI
+    * Note: This object will still assume memory ownership of the returned SofAMapping objects
+    * that are returned.
+    **/
+    const TyVecpSofaMappings & getSofaMappings() const {
+      return iv_SofaMappings;
+    }
+
+
+    /**  BSI
+    * NOTE: This object will assume memory ownership of <code>pSofaMappings</code>, i.e.
+    * it will be deleted when this object's destructor is called !
+    **/
+    TyErrorId setSofaMappings(TyVecpSofaMappings * pSofaMappings) {
+      if (! isModifiable()) {
+        return UIMA_ERR_CONFIG_OBJECT_COMITTED;
+      }
+      iv_SofaMappings = *pSofaMappings;
+      return UIMA_ERR_NONE;
+    }
+    /**
+    * NOTE: This object will assume memory ownership of <code>SofaMapping</code>, i.e.
+    * it will be deleted when this object's destructor is called !
+    **/
+    TyErrorId addSofaMapping(SofaMapping * pSofaMapping) {
+      if (! isModifiable()) {
+        return UIMA_ERR_CONFIG_OBJECT_COMITTED;
+      }
+      iv_SofaMappings.push_back(pSofaMapping);
+      return UIMA_ERR_NONE;
+    }
+
+    /**
+    * Note: This object will still assume memory ownership of the AnalysisEngineDescription
+    * that is returned.
+    * Returns NULL if no delegate can be found for key
+    **/
+    AnalysisEngineDescription * getDelegate(const icu::UnicodeString & key) const;
+
+    /**
+    * Note: This object will delete the AnalysisEngineDescription returned from
+    * its map of delegate specifiers. Memory ownership is transferred to the caller
+    * of this method !
+    * Returns NULL if no delegate can be found for key
+    **/
+    AnalysisEngineDescription * extractDelegate(const icu::UnicodeString & key);
+
+    /**
+    * returns a reference to the NameValuePair whose name is paramName
+    * iff
+    * a) there are no configuration groups defined or there is a default group defined.
+    * b) a NameValuePair with the name exists in the configuration settings of this taespecifier
+    *
+    * Otherwise, returns NULL.
+    **/
+    NameValuePair * getNameValuePair(const icu::UnicodeString & paramName,
+                                     const icu::UnicodeString & ancKey="") {
+      return iv_pAeMetaData->getNameValuePair(paramName, ancKey);
+    }
+
+    /**
+    * returns a reference to the NameValuePair whose name is paramName
+    * iff
+    * a) there are configuration groups defined
+    * b) a NameValuePair with the name exists in the configuration settings
+    *    of the 'appropriate' group. This group may either be groupName or one of the fallback
+    *    groups specified by the strategy
+    * OR
+    * a) groupName == <code>CONFIG_GROUP_NAME_WHEN_NO_GROUPS</code>
+    * b) a NameValuePair with the name exists in the configuration settings
+    *
+    * Throws an exception if a value is found, but the parameter is not defined.
+    * Throws an exception if no groups are defined and groupName != <code>CONFIG_GROUP_NAME_WHEN_NO_GROUPS</code>
+    *
+    * Otherwise, returns NULL.
+    **/
+    NameValuePair * getNameValuePair(const icu::UnicodeString & groupName,
+                                     const icu::UnicodeString & paramName,
+                                     AnalysisEngineMetaData::EnSearchStrategy strategy,
+                                     const icu::UnicodeString & ancKey="") {
+      return iv_pAeMetaData->getNameValuePair(groupName, paramName, strategy, ancKey);
+    }
+
+    /**
+    * TyErrorId == UIMA_ERR_NONE iff
+    * a) there are groups: the name of nvPair is a configuration parameter defined
+    *    in the common parameters or in the default group
+    * b) there are no groups:  the name of nvPair is a configuration parameter
+    * If above conditions hold true, nvPair will be added to
+    * a) the settings of the default group
+    * b) the configuration settings
+    **/
+    TyErrorId setNameValuePair(const NameValuePair & nvPair) {
+      return iv_pAeMetaData->setNameValuePair(nvPair);
+    }
+
+    /**
+    * TyErrorId == UIMA_ERR_NONE iff
+    * a) there is a group groupName in the configuration parameters
+    * b) the name of nvPair is a configuration parameter defined in groupName
+    **/
+    TyErrorId setNameValuePair(const icu::UnicodeString & groupName,
+                               const NameValuePair & nvPair) {
+      return iv_pAeMetaData->setNameValuePair(groupName, nvPair);
+    }
+
+    /**
+     * converts this specifier to an XML buffer.
+     */
+    void toXMLBuffer(icu::UnicodeString &) const;
+    void appendConfigParamsAndSettingsToXMLBuffer(UnicodeString & s) const;
+
+    TyErrorId setFrameworkImplName(EnFrameworkImplName impl) {
+      if (! isModifiable()) {
+        return UIMA_ERR_CONFIG_OBJECT_COMITTED;
+      }
+      iv_enFrameImpl = impl;
+      return UIMA_ERR_NONE;
+    }
+
+    TyErrorId setAnnotatorImpName(const icu::UnicodeString & anName) {
+      if (! isModifiable()) {
+        return UIMA_ERR_CONFIG_OBJECT_COMITTED;
+      }
+      iv_annotatorImpName = anName;
+      return UIMA_ERR_NONE;
+    }
+
+  protected:
+    void appendToXMLBuffer(AnalysisEngineMetaData::TyVecpFSIndexDescriptions const & fsDesc,
+                           icu::UnicodeString & s);
+
+    void appendToXMLBuffer(AnalysisEngineMetaData::TyVecpTypePriorities const  & prioDesc,
+                           icu::UnicodeString & s);
+
+    void appendToXMLBuffer(TyVecpSofaMappings const & sofaMapDesc,
+                           icu::UnicodeString & s);
+
+  private:
+    AnalysisEngineDescription(AnalysisEngineDescription const & crOther);
+    AnalysisEngineDescription & operator=(AnalysisEngineDescription const & crOther);
+
+
+    void toXMLBufferNoXMLHeader(icu::UnicodeString & s) const;
+    void appendConfigGroupToXMLBuffer(ConfigurationGroup const & config, icu::UnicodeString & s) const;
+    void appendConfigGroupSettingsToXMLBuffer(SettingsForGroup const & settings, icu::UnicodeString & s) const;
+   
+    bool iv_bPrimitive;
+    EnFrameworkImplName iv_enFrameImpl;
+    icu::UnicodeString iv_annotatorImpName;
+
+
+    //If the AnalysisEngineDescription was built from an xml file, contains the
+    //path to the file on the file system
+    icu::UnicodeString iv_xmlFileLoc;
+    icu::UnicodeString iv_xmlRootTag;
+
+    //maps the 'key' attribute of a delegateAnalysisEngine to the corresponding specifier
+    //had to use pointer here, otherwise it wouldn't compile on MS Visual C++ 6
+    TyMapDelegateSpecs * iv_pMapDelegateSpecifiers;
+    AnalysisEngineMetaData * iv_pAeMetaData;
+    //BSI
+    TyVecpSofaMappings iv_SofaMappings;
+
+
+  };
+  
+
+  class  UIMA_LINK_IMPORTSPEC TextAnalysisEngineSpecifier : public AnalysisEngineDescription {
+  public:
+    friend class XMLParser;
+    friend class CasDefinition;
+    TextAnalysisEngineSpecifier()
+        :AnalysisEngineDescription() {
+    }
+
+  };
+}
+
+#endif
+
+

Propchange: incubator/uima/uimacpp/trunk/src/framework/uima/taespecifier.hpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/uima/uimacpp/trunk/src/framework/uima/taespecifierbuilder.hpp
URL: http://svn.apache.org/viewvc/incubator/uima/uimacpp/trunk/src/framework/uima/taespecifierbuilder.hpp?view=auto&rev=503251
==============================================================================
--- incubator/uima/uimacpp/trunk/src/framework/uima/taespecifierbuilder.hpp (added)
+++ incubator/uima/uimacpp/trunk/src/framework/uima/taespecifierbuilder.hpp Sat Feb  3 08:58:54 2007
@@ -0,0 +1,457 @@
+#ifndef UIMA_TAESPECIFIERBUILDER_HPP
+#define UIMA_TAESPECIFIERBUILDER_HPP
+/** \file taespecifierbuilder.hpp .
+-----------------------------------------------------------------------------
+
+
+
+
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+
+-----------------------------------------------------------------------------
+
+    \brief Contains uima::TextAnalysisEngineSpecifierBuilder
+
+   Description: Builds a AnalysisEngineDescription from an XML file or memory buffer.
+
+-----------------------------------------------------------------------------
+
+
+-------------------------------------------------------------------------- */
+
+
+/* ----------------------------------------------------------------------- */
+/*       Include dependencies                                              */
+/* ----------------------------------------------------------------------- */
+
+#include "xercesc/dom/DOMNode.hpp"
+#include "xercesc/dom/DOMElement.hpp"
+#include "xercesc/sax/ErrorHandler.hpp"
+#include "xercesc/sax/InputSource.hpp"
+
+#include "uima/pragmas.hpp"
+#include "uima/exceptions.hpp"
+#include "uima/taespecifier.hpp"
+#include "uima/config_param.hpp"
+#include "uima/capability.hpp"
+#include "uima/typesystemdescription.hpp"
+#include "uima/resmgr.hpp"
+/* ----------------------------------------------------------------------- */
+/*       Forward declarations                                              */
+/* ----------------------------------------------------------------------- */
+XERCES_CPP_NAMESPACE_USE
+
+namespace uima {
+  class XIncludeRemoverHandler;
+}
+
+/* ----------------------------------------------------------------------- */
+/*       Types / Classes                                                   */
+/* ----------------------------------------------------------------------- */
+
+namespace uima {
+
+  UIMA_EXC_CLASSDECLARE(InvalidXMLException, uima::Exception);
+  
+  /**
+   * A UIMA <code>XMLParser</code> parses XML documents and generates UIMA component 
+   * descriptor object represented in the XML.
+   */
+  class UIMA_LINK_IMPORTSPEC XMLParser {
+ 
+  public:
+
+    XMLParser();
+    ~XMLParser();
+
+    void setErrorHandler(ErrorHandler*);
+
+	/**
+     * Enables or disables XML scheam validation.
+     * 
+     * @param aEnable
+     *          true to enable validation, false to disable validation
+     */
+    //void enableSchemaValidation(bool aEnable);
+
+	/**
+	 * Parses an AnalysisEngineDescription from an XML file.
+     * 
+     * @param aeDesc
+     *          reference to <code>AnalysisEngineDescription</code> object 
+	 *        fileName
+     *          char buffer file containing the XML document to be parsed.
+     * 
+     * @throws InvalidXMLException
+     *     if the input XML is not valid or does not specify a valid AnalysisEngineDescription
+	 */
+	void parseAnalysisEngineDescription(AnalysisEngineDescription & aeDesc,
+										char const * fileName);
+    /**
+	 * Parses an AnalysisEngineDescription from an XML file.
+     * 
+     * @param aeDesc
+     *          reference to <code>AnalysisEngineDescription</code> object
+     *        fileName 
+	 *          UnicodeStrin object containing the file name of the file cotaining the XML document.
+     * 
+     * @throws InvalidXMLException
+     *     if the input XML is not valid or does not specify a valid AnalysisEngineDescription
+	 */
+	void parseAnalysisEngineDescription(AnalysisEngineDescription & aeDesc,
+										icu::UnicodeString const & fileName);
+
+	/**
+	 * Parses an AnalysisEngineDescription from an XML input stream.
+     * 
+     * @param aeDesc
+	 *          reference to <code>AnalysisEngineDescription</code> object.
+	 *        crInputSource
+     *          the input source from which to read the XML document.
+     * 
+     * 
+     * @throws InvalidXMLException
+     *     if the input XML is not valid or does not specify a valid AnalysisEngineDescription
+	 */
+    void parseAnalysisEngineDescription(AnalysisEngineDescription & aeDesc, 
+										InputSource const & crInputSource);
+    /**
+	 * Parses an TypeSystemDescription from an XML input stream.
+     * 
+	 * @param aeDesc
+	 *          reference to <code>TypeSystemDescription</code> object.
+	 *        crInputSource
+     *          the input source from which to read the XML document.
+     * 
+     * @throws InvalidXMLException
+     *     if the input XML is not valid or does not specify a valid AnalysisEngineDescription
+	 */
+	void parseTypeSystemDescription(TypeSystemDescription & aeDesc, 
+											InputSource const & crInputSource);
+    /**
+	 * Parses an FSIndexDescriptions from an XML input stream.
+	 * Caller assumes ownership of objects in the vector.
+     * 
+	 * @param fsDesc
+	 *          reference to <code>TyVecpFSIndexDescriptions</code> object.
+	 *        crInputSource
+     *          the input source from which to read the XML document.
+     *
+     * 
+     * @throws InvalidXMLException
+     *     if the input XML is not valid or does not specify a valid AnalysisEngineDescription
+	 */
+    void parseFSIndexDescription(AnalysisEngineMetaData::TyVecpFSIndexDescriptions  & fsDesc,
+											InputSource const &  crInputSource);
+    /**
+	 * Parses an TypePriorities from an XML input stream.
+     * Caller assumes ownership of objects in the vector.
+	 *
+     * @param prioDesc
+	 *          reference to <code>TyVecpTypePriorities</code> object.
+	 *        crInputSource
+     *          the input source from which to read the XML document.
+	 *
+     * @throws InvalidXMLException
+     *     if the input XML is not valid or does not specify a valid AnalysisEngineDescription
+	 */
+    void parseTypePriorities(AnalysisEngineMetaData::TyVecpTypePriorities  & prioDesc,
+											InputSource const & crInputSource);
+    /**
+	 * Parses an SofaMappings from an XML input stream.
+     * Caller assumes ownership of objects in the vector.
+     * @param sofaMapDesc
+	 *          reference to <code>TyVecpTypePriorities</code> object.
+	 *        crInputSource
+     *          the input source from which to read the XML document.
+     * 
+     * @throws InvalidXMLException
+     *     if the input XML is not valid or does not specify a valid AnalysisEngineDescription
+	 */
+    void parseSofaMappings(AnalysisEngineDescription::TyVecpSofaMappings  & sofaMapDesc,
+											InputSource const & crInputSource);
+
+  private:
+    
+    AnalysisEngineMetaData * buildAEMetaData(DOMElement * specElem, icu::UnicodeString const &);
+    
+    ConfigurationParameter * buildConfigParam(DOMElement * specElem);
+    NameValuePair * buildNameValuePair(DOMElement * specElem);
+    void buildValue(NameValuePair & nvPair, DOMElement * specElem);
+    ConfigurationParameter::EnParameterType findTypeForValue(DOMNode * descElem);
+
+	void buildTypeSystemSpecifier(TypeSystemDescription & tsDesc, DOMElement* specElem,const icu::UnicodeString & xmlFileLoc);
+    void buildTypeSystemDesc(TypeSystemDescription & tsDesc, DOMElement * specElem);
+    TypeDescription * buildTypeDesc(DOMElement * specElem);
+    FeatureDescription * buildFeatureDesc(DOMElement * specElem);
+    AllowedValue * buildAllowedValue(DOMElement * specElem);
+    ImportDescription * buildImportDesc(DOMElement * specElem);
+    TypePriority * buildTypePriority(DOMElement * specElem);
+	void buildTypePriorityFromImportLocation(AnalysisEngineMetaData  & aeDesc,
+        icu::UnicodeString const & fileName,
+        icu::UnicodeString const & lastFileName,
+        vector<icu::UnicodeString> & alreadyImported);
+	void buildFSIndexFromImportLocation(AnalysisEngineMetaData  &aeMetaData,
+                                        icu::UnicodeString const &  importfn,
+                                        vector<icu::UnicodeString> & alreadyImported,
+                                        icu::UnicodeString const &  lastFileName);
+    void buildFSIndexCollection(AnalysisEngineMetaData & aeMetaData,
+                                DOMElement * specElem,
+                                vector<icu::UnicodeString> & alreadyImported,
+                                icu::UnicodeString const &  lastFileName);
+    FSIndexDescription * buildFSIndexDesc(DOMElement * specElem);
+    FSIndexKeyDescription * buildFSIndexKeyDesc(DOMElement * specElem);
+
+    void buildCapabilities(AnalysisEngineMetaData & aeMetaData, DOMElement * specElem);
+    void buildCapability(AnalysisEngineMetaData & aeMetaData, DOMElement * specElem);
+
+    FixedFlow * buildFixedFlow(DOMElement * specElem);
+    CapabilityLanguageFlow * buildCapabilityLanguageFlow(DOMElement * specElem);
+    FlowConstraints* buildFlowConstraints(DOMElement * specElem);
+    SofaMapping * buildSofaMapping(DOMElement * specElem);
+     XMLCh const * convert(char const * cpBuf) const;
+    icu::UnicodeString convert( XMLCh const * cpUCBuf ) const;
+    icu::UnicodeString getSpannedText(DOMNode * node);
+    DOMNode * findFirst(DOMNodeList * nodes, char const * tagName);
+    DOMElement * findFirstElementNode(DOMNodeList * nodes);
+    bool isTrue(const icu::UnicodeString & value) const;
+    bool isDefined(const XMLCh * attrVal) const;
+
+  protected:
+    /* protected in order to allow access by the subclass 
+	 * TextAnalysisEngineSpecifierBuilder.
+     */
+    void buildAnalysisEngineDescription(AnalysisEngineDescription & taeSpec, DOMElement * specElem,
+                  const icu::UnicodeString & xmlFileLoc);
+	void buildTypePriorities(AnalysisEngineMetaData::TyVecpTypePriorities & typePriorities, DOMElement * specElem);
+    
+	void buildTypePriorities(AnalysisEngineMetaData & aeMetaData,
+                                DOMElement * specElem,
+								icu::UnicodeString const & lastFileName,
+                                vector<icu::UnicodeString> & alreadyImported);
+   
+	void buildFSIndexes(AnalysisEngineMetaData & aeDesc, DOMElement * specElem);
+	void buildFSIndexes(AnalysisEngineMetaData::TyVecpFSIndexDescriptions & desc, DOMElement * specElem);
+
+    void buildSofaMappings(AnalysisEngineDescription & taeSpec, DOMElement * specElem);
+	void buildSofaMappings(AnalysisEngineDescription::TyVecpSofaMappings & sofaMappings, DOMElement * specElem);
+    
+	void buildConfigParams(AnalysisEngineMetaData & aeMetaData, DOMElement * specElem);
+    void buildConfigParamSettings(AnalysisEngineMetaData & aeMetaData, DOMElement * specElem);
+	
+  private:
+    ErrorHandler * iv_pXMLErrorHandler;
+	bool doSchemaValidation;
+	TCHAR * schemaFileName;
+   
+    static char const * TAG_AE_DESC;
+    static char const * TAG_TAE_DESC;
+    static char const * TAG_CAS_DESC;
+    static char const * TAG_RESMGR_CONFIG_DESC;
+    static char const * TAG_CASCONSUMER_DESC;
+    static char const * TAG_PROCESSING_RESOURCE_METADATA;
+    static char const * TAG_IMPL_NAME;
+    static char const * TAG_TAE_PRIMITIVE;
+    static char const * TAG_DELEGATE_AES;
+    static char const * TAG_DELEGATE_AE;
+    static char const * TAG_DELEGATE_AE_INCLUDE;
+    static char const * UIMA_FRAMEWORK_IMP;
+    static char const * TAG_AN_IMPL_NAME;
+    static char const * TAG_EXTERNAL_RESOURCE_DEPENDENCIES;
+    static char const * TAG_EXTERNAL_RESOURCES;
+    static char const * TAG_AE_METADATA;
+    static char const * TAG_AE_NAME;
+    static char const * TAG_AE_DESCRIPTION;
+    static char const * TAG_AE_VERSION;
+    static char const * TAG_AE_VENDOR;
+    static char const * TAG_CONFIG_PARAMS;
+    static char const * TAG_CONFIG_PARAM_GROUP;
+    static char const * TAG_CONFIG_PARAM_COMMON;
+    static char const * TAG_CONFIG_PARAM;
+    static char const * TAG_CONFIG_PARAM_NAME;
+    static char const * TAG_CONFIG_PARAM_DESC;
+    static char const * TAG_CONFIG_PARAM_TYPE;
+    static char const * TAG_CONFIG_PARAM_MULTIVAL;
+    static char const * TAG_CONFIG_PARAM_MANDATORY;
+    static char const * TAG_CONFIG_PARAM_RESTRICT;
+    static char const * TAG_CONFIG_PARAM_SETTINGS;
+    static char const * TAG_CONFIG_PARAM_SETTING_GROUP;
+    static char const * TAG_NAME_VALUE_PAIR;
+    static char const * TAG_NAME_VALUE_PAIR_NAME;
+    static char const * TAG_NAME_VALUE_PAIR_VALUE;
+    static char const * TAG_NAME_VALUE_PAIR_VALUE_STRING;
+    static char const * TAG_NAME_VALUE_PAIR_VALUE_INT;
+    static char const * TAG_NAME_VALUE_PAIR_VALUE_FLOAT;
+    static char const * TAG_NAME_VALUE_PAIR_VALUE_BOOL;
+    static char const * TAG_NAME_VALUE_PAIR_VALUE_ARRAY;
+    static char const * TAG_ENV_VAR_REF;
+    static char const * TAG_IMPORTS;
+    static char const * TAG_IMPORT_DESC;
+    static char const * ATTR_IMPORT_DESC_NAME;
+    static char const * ATTR_IMPORT_DESC_LOCATION;
+    static char const * TAG_TYPE_SYSTEM_DESC;
+    static char const * TAG_TYPES;
+    static char const * TAG_TYPE_DESC;
+    static char const * TAG_TYPE_DESC_NAME;
+    static char const * TAG_TYPE_DESC_SUPER;
+    static char const * TAG_TYPE_DESC_DESC;
+    static char const * TAG_TYPE_DESC_ALLOWED_VALS;
+    static char const * TAG_TYPE_DESC_ALLOWED_VALS_VAL;
+    static char const * TAG_TYPE_DESC_ALLOWED_VALS_VAL_STRING;
+    static char const * TAG_TYPE_DESC_ALLOWED_VALS_VAL_DESC;
+    static char const * TAG_TYPE_DESC_FEATURES;
+    static char const * TAG_TYPE_DESC_FEAT_DESC;
+    static char const * TAG_TYPE_DESC_FEAT_DESC_NAME;
+    static char const * TAG_TYPE_DESC_FEAT_DESC_RANGE;
+    static char const * TAG_TYPE_DESC_FEAT_DESC_DESC;
+    static char const * TAG_TYPE_PRIORITIES;
+    static char const * TAG_TYPE_PRIORITY_LIST;
+    static char const * TAG_TYPE_PRIORITY_LIST_TYPE;
+    static char const * TAG_FS_INDEXES;
+    static char const * TAG_FS_INDEX_COLLECTION;
+    static char const * TAG_FS_INDEX_DESC;
+    static char const * TAG_FS_INDEX_DESC_LABEL;
+    static char const * TAG_FS_INDEX_DESC_TYPE;
+    static char const * TAG_FS_INDEX_DESC_KIND;
+    static char const * TAG_FS_INDEX_DESC_KEYS;
+    static char const * TAG_FS_INDEX_KEY;
+    static char const * TAG_FS_INDEX_KEY_FEAT;
+    static char const * TAG_FS_INDEX_KEY_COMP;
+    static char const * TAG_FS_INDEX_KEY_TYPE_PRIORITY;
+    static char const * TAG_CAPABILITIES;
+    static char const * TAG_CAPABILITY;
+    static char const * TAG_CAP_INPUTS;
+    static char const * TAG_CAP_OUTPUTS;
+    static char const * TAG_CAP_TYPE;
+    static char const * TAG_CAP_FEATURE;
+    static char const * TAG_CAP_INPUT_SOFAS;
+    static char const * TAG_CAP_OUTPUT_SOFAS;
+    static char const * TAG_CAP_SOFA_NAME;
+    static char const * TAG_SOFA_MAPPINGS;
+    static char const * TAG_SOFA_MAPPING;
+    static char const * TAG_SOFAMAP_COMPONENT_KEY;
+    static char const * TAG_SOFAMAP_COMPONENT_SOFA_NAME;
+    static char const * TAG_SOFAMAP_AGGREGATE_SOFA_NAME;
+    static char const * TAG_CAP_LANG_SUPP;
+    static char const * TAG_CAP_LANG;
+    static char const * TAG_FLOW;
+    static char const * TAG_FLOW_FIX;
+    static char const * TAG_FLOW_FIX_NODE;
+    static char const * TAG_FLOW_CAPABILITY_LANG;
+    static char const * TAG_FLOW_CAPABILITY_LANG_NODE;
+    static char const * ATTR_DELEGATE_AE_KEY;
+    static char const * ATTR_DELEGATE_AE_INCLUDE_FILE;
+    static char const * ATTR_CONFIG_PARAMS_DEF_GROUP;
+    static char const * ATTR_CONFIG_PARAMS_SEARCH;
+    static char const * ATTR_CONFIG_PARAM_GROUP_NAMES;
+    static char const * ATTR_CONFIG_PARAM_SETTING_GROUP_NAMES;
+    static char const * ATTR_CAP_FEATURE_ALL;
+    static char const * TRUE_VALUE;
+    static char const * FRAMEWORK_IMP_CPLUSPLUS;
+    static char const * FRAMEWORK_IMP_JAVA;
+    static char const * NO_FALLBACK;
+    static char const * DEFAULT_FALLBACK;
+    static char const * LANGUAGE_FALLBACK;
+    static char const * CONFIG_PARAM_STRING_TYPE;
+    static char const * CONFIG_PARAM_INTEGER_TYPE;
+    static char const * CONFIG_PARAM_FLOAT_TYPE;
+    static char const * CONFIG_PARAM_BOOLEAN_TYPE;
+    static char const * FS_INDEX_KEY_COMP_STANDARD;
+    static char const * FS_INDEX_KEY_COMP_REVERSE;
+    static char const * FS_INDEX_KEY_KIND_SORTED;
+    static char const * FS_INDEX_KEY_KIND_BAG;
+    static char const * FS_INDEX_KEY_KIND_SET;
+  };
+
+
+  //-------------------------------------------------
+  // @deprecated
+  // TextAnalysisEngineSpecifierBuilder
+  //-------------------------------------------------
+  class UIMA_LINK_IMPORTSPEC TextAnalysisEngineSpecifierBuilder : public XMLParser {
+  
+  public:
+    /**@deprecated*/
+    TextAnalysisEngineSpecifierBuilder();
+	 /**@deprecated*/
+    ~TextAnalysisEngineSpecifierBuilder();
+	 /**@deprecated*/
+    void buildTae(AnalysisEngineDescription & taeSpec, DOMElement * specElem,
+                  const icu::UnicodeString & xmlFileLoc);
+     /**@deprecated*/
+    void buildTaeFromFile(AnalysisEngineDescription & taeSpec, icu::UnicodeString const & fileName);
+     /**@deprecated*/ 
+	void buildTaeFromFile(AnalysisEngineDescription & taeSpec, char const * fileName);
+	 /**@deprecated*/
+	void buildTaeFromMemory(AnalysisEngineDescription & taeSpec, icu::UnicodeString const & xmlString);
+     /**@deprecated*/
+	void buildTaeFromMemory(AnalysisEngineDescription & taeSpec, char const * cpszXMLString);
+     /**@deprecated*/
+    TypeSystemDescription * buildTypeSystemSpecifierFromFile(char const * filename);
+     /**@deprecated*/
+	TypeSystemDescription * buildTypeSystemSpecifierFromFile(icu::UnicodeString const & fileName);
+     /**@deprecated*/
+	TypeSystemDescription * buildTypeSystemSpecifierFromMemory(icu::UnicodeString const & xmlString);
+     /**@deprecated*/
+	TypeSystemDescription * buildTypeSystemSpecifierFromXMLBuffer(char const * xmlString);
+	 /**@deprecated*/
+    void buildConfigParams(AnalysisEngineMetaData & aeDesc, DOMElement * specElem);
+     /**@deprecated*/
+    void buildConfigParamSettings(AnalysisEngineMetaData & aeDesc, DOMElement * specElem);
+     /**@deprecated*/
+    void buildTypePriorities(AnalysisEngineMetaData & aeDesc, DOMElement * specElem, icu::UnicodeString const & xmlFileLoc, vector<icu::UnicodeString> & alreadyImported);
+     /**@deprecated*/
+    void buildTypePriorities(AnalysisEngineMetaData::TyVecpTypePriorities & typePriorityDesc, DOMElement * specElem);
+	 /**@deprecated*/
+    void buildFSIndexes(AnalysisEngineMetaData & aeDesc, DOMElement * specElem);
+     /**@deprecated*/
+    void buildFSIndexes(AnalysisEngineMetaData::TyVecpFSIndexDescriptions & vecFSIndexDescs,
+                        DOMElement * descElem);
+     /**@deprecated*/
+    void buildSofaMappings(AnalysisEngineDescription::TyVecpSofaMappings& sofaMapDesc,
+                           DOMElement * specElem);
+     /**@deprecated*/
+    void appendToXMLBuffer(AnalysisEngineMetaData::TyVecpFSIndexDescriptions const & fsDesc,
+                           icu::UnicodeString &  xmlString);
+     /**@deprecated*/
+    void appendToXMLBuffer(AnalysisEngineMetaData::TyVecpTypePriorities const & prioDesc,
+                           icu::UnicodeString & xmlString);
+     /**@deprecated*/
+    void appendToXMLBuffer(AnalysisEngineDescription::TyVecpSofaMappings const & sofaMapDesc,
+                           icu::UnicodeString & xmlString);
+
+    //xmlString must have been created by calling one of the appendToXMLBuffer methods above
+    //and inserting the xml header at the beginning.
+    //Caller assumes memory ownership of objects in the vectors
+	/**@deprecated*/
+    void buildFromXMLBuffer(AnalysisEngineMetaData::TyVecpFSIndexDescriptions  & fsDesc,
+                            icu::UnicodeString const &  xmlString);
+    /**@deprecated*/
+    void buildFromXMLBuffer(AnalysisEngineMetaData::TyVecpTypePriorities  & prioDesc,
+                            icu::UnicodeString const & xmlString);
+    /**@deprecated*/
+    void buildFromXMLBuffer(AnalysisEngineDescription::TyVecpSofaMappings  & sofaMapDesc,
+                            icu::UnicodeString const & xmlString);
+
+};
+
+
+}
+
+#endif
+

Propchange: incubator/uima/uimacpp/trunk/src/framework/uima/taespecifierbuilder.hpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/uima/uimacpp/trunk/src/framework/uima/text.h
URL: http://svn.apache.org/viewvc/incubator/uima/uimacpp/trunk/src/framework/uima/text.h?view=auto&rev=503251
==============================================================================
--- incubator/uima/uimacpp/trunk/src/framework/uima/text.h (added)
+++ incubator/uima/uimacpp/trunk/src/framework/uima/text.h Sat Feb  3 08:58:54 2007
@@ -0,0 +1,111 @@
+/** \file text.h .
+-----------------------------------------------------------------------------
+
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+
+-----------------------------------------------------------------------------
+
+    \brief Types and operations for text C strings (Support for UNICODE, SBCS and DBCS)
+
+
+-------------------------------------------------------------------------- */
+
+#ifndef __UIMA_TEXT_H
+#define __UIMA_TEXT_H
+
+/* ----------------------------------------------------------------------- */
+/*       Interface dependencies                                            */
+/* ----------------------------------------------------------------------- */
+
+/* ----------------------------------------------------------------------- */
+/*       Implementation dependencies                                       */
+/* ----------------------------------------------------------------------- */
+
+/* ----------------------------------------------------------------------- */
+/*       Constants                                                         */
+/* ----------------------------------------------------------------------- */
+
+/* ----------------------------------------------------------------------- */
+/*       Types / Classes                                                   */
+/* ----------------------------------------------------------------------- */
+
+#if defined(UNICODE) && !defined(_UNICODE)
+#define _UNICODE
+#endif
+
+// A couple of text macros for other than MS VC++
+
+/** @name UNICODE character support */
+/*@{*/
+#ifdef _MSC_VER
+
+#include <tchar.h>
+
+#else /* all other platforms */
+
+/* support for "TCHAR", "_TEXT", and "_T" in case there is no UNICODE support */
+#ifdef _UNICODE
+#error Conflict, current host OS supports UNICODE
+#endif
+
+#if defined(__tchar_h) || defined(__tchar) || defined(__tint) || defined(_INC_TCHAR)
+#error Conflict, current host OS supports TCHAR
+#endif
+
+/* for UNICODE characters use the TCHAR type */
+
+typedef char TCHAR;
+
+/* for UNICODE text constants use the _TEXT() macro */
+
+#define _TEXT(x)    x
+
+#endif
+/*@}*/
+
+/* ----------------------------------------------------------------------- */
+/*       Globals                                                           */
+/* ----------------------------------------------------------------------- */
+
+/* ----------------------------------------------------------------------- */
+/*       Function declarations                                             */
+/* ----------------------------------------------------------------------- */
+
+/* ----------------------------------------------------------------------- */
+/*       Macro definitions                                                 */
+/* ----------------------------------------------------------------------- */
+
+/* ----------------------------------------------------------------------- */
+/*       Private implementation                                            */
+/* ----------------------------------------------------------------------- */
+
+/* ----------------------------------------------------------------------- */
+/*       Protected implementation                                          */
+/* ----------------------------------------------------------------------- */
+
+/* ----------------------------------------------------------------------- */
+/*       Public implementation                                             */
+/* ----------------------------------------------------------------------- */
+
+/* ----------------------------------------------------------------------- */
+/*       Implementation                                                    */
+/* ----------------------------------------------------------------------- */
+
+#endif /* __UIMA_TEXT_H */
+
+/* <EOF> */

Propchange: incubator/uima/uimacpp/trunk/src/framework/uima/text.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/uima/uimacpp/trunk/src/framework/uima/timedatetools.hpp
URL: http://svn.apache.org/viewvc/incubator/uima/uimacpp/trunk/src/framework/uima/timedatetools.hpp?view=auto&rev=503251
==============================================================================
--- incubator/uima/uimacpp/trunk/src/framework/uima/timedatetools.hpp (added)
+++ incubator/uima/uimacpp/trunk/src/framework/uima/timedatetools.hpp Sat Feb  3 08:58:54 2007
@@ -0,0 +1,171 @@
+#ifndef UIMA_TIMEDATETOOLS_HPP_
+#define UIMA_TIMEDATETOOLS_HPP_
+/** \file timedatetools.hpp .
+-------------------------------------------------------------------------------
+
+
+
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+
+-------------------------------------------------------------------------------
+
+    \brief  Contains Timer and timing tool functions/macros
+
+-------------------------------------------------------------------------------
+*/
+
+#include "uima/pragmas.hpp" // must be first file to be included to get pragmas
+#include <time.h>
+#include <limits.h>
+#include <float.h>
+#include <string>
+#include "uima/types.h"
+#include "uima/strtools.hpp"
+
+
+namespace uima {
+
+#ifdef DEBUG_TIMING
+#  ifdef UIMA_TIMING
+#     undef UIMA_TIMING
+#  endif
+  /** A macro in which our timing statements are hidden,
+     if DEBUG_TIMING is <EM>not</EM> defined.
+     Using a timer <TT>clTimer</TT> of type <TT>Timer</TT> the macro can be used
+     in statements like:
+     <TT>UIMA_TIMING(clTimer.start)</TT> and <TT>UIMA_TIMING(clTimer.start)</TT>
+  */
+#  define UIMA_TIMING( expr ) ( expr )
+#else
+#  ifdef UIMA_TIMING
+#     undef UIMA_TIMING
+#  endif
+#  define UIMA_TIMING( ignore ) ( ( void )0 )
+#endif
+
+  /**
+   * Function <TT>currTimeString</TT> is a help function to return the current
+   * time/data as a string.
+   * Note: This should be made more flexible in the output format
+   *
+   * @return a string with the current time/date
+   *
+   */
+  inline std::string
+  tafCurrTimeDateString() {
+    time_t ltime;
+    (void)time(&ltime);   //get time, ignore return value
+    return asctime(localtime(&ltime)); //time string
+  }
+
+
+  /**
+   * Class <TT>ClTimer</TT> is a tool class to help with timing.
+   * It includes some useful string output for timers.
+   *
+   */
+//class UIMA_LINK_IMPORTSPEC Timer : public CosClTiming
+  class UIMA_LINK_IMPORTSPEC Timer {
+  public:
+    ///Constructor
+//   Timer(const std::string & clstrDescription = ""):
+//      CosClTiming(),
+//      iv_strDecscription(clstrDescription)
+//      {}
+    Timer(const std::string & clstrDescription = "") {}
+
+    void start(void) {}
+    void stop(void) {}
+    void reset(void) {}
+
+    /** Retrieve the accumulated time
+       To avoid division by zero errors we never return zero
+       but FLT_MIN instead.
+     */
+    double getAccumulatedTime(void) const {
+//         return ((CosClTiming*)this)->getAccumulatedTime() > 0 ?
+//                  ((CosClTiming*)this)->getAccumulatedTime() :
+//                  FLT_MIN;
+      return 0;
+    }
+
+    ///Returns timed time up to now
+    double getTimeSoFar() const {
+      // Not implemented
+      return((double)0.0);
+    }
+
+    /** @name Formated string output for timer data */
+    /*@{*/
+    ///Returns the description from the constructor (used by follwing functions)
+    std::string getDescription(size_t padWidth = 35) const;
+    ///Returns the description from the constructor (used by follwing functions)
+    void setDescription(const std::string & crstrDesc) {
+      iv_strDecscription = crstrDesc;
+    }
+    ///Returns &lt;DESCRIPTION>:      &lt;accumulatedTime> seconds
+    std::string timeString() const;
+    ///Returns &lt;DESCRIPTION>:      &lt;items/accumulatedTime> &lt;itemname> / second
+    std::string relativeThroughputString(size_t items, const std::string & itemsname = "") const;
+    ///Returns &lt;DESCRIPTION>:      &lt;accumulatedTime/relative_to_seconds>%
+    std::string percentString(double relative_to_seconds) const;
+    ///Returns &lt;DESCRIPTION>:      &lt;accumulatedTime/relative_to_seconds>%
+    std::string percentString(const Timer& relative_to_timer) const;
+    ///Returns absolute (timeString) and relative (percentString) as one string
+    std::string timeAndPercentString(double relative_to_seconds) const;
+    ///Returns absolute (timeString) and relative (percentString) as one string
+    std::string timeAndPercentString(const Timer& relative_to_timer) const;
+    ///Returns combination of <TT>timeAndPercentString</TT> plus <TT>relativeThroughputString</TT>
+    std::string timeAndPercentAndThroughputString(double relative_to_seconds, size_t relative_to_items, const std::string & itemsname = "") const;
+    static std::string timeString(double dTime);
+    /*@}*/
+    /** @name Operators to combine timers */
+    /*@{*/
+    /// Addition of timers
+    Timer
+    operator+(const Timer & crclOther) const {
+      Timer clTmp(iv_strDecscription);
+      if (crclOther.iv_strDecscription.length() > 0) {
+        clTmp.setDescription(iv_strDecscription + " + " + crclOther.iv_strDecscription);
+      }
+//      clTmp.iv_dAccumulatedTime = iv_dAccumulatedTime + crclOther.iv_dAccumulatedTime;
+      return clTmp;
+    }
+    /// Subtraction of timers
+    Timer
+    operator-(const Timer & crclOther) const {
+      Timer clTmp(iv_strDecscription);
+      if (crclOther.iv_strDecscription.length() > 0) {
+        clTmp.setDescription(iv_strDecscription + " - " + crclOther.iv_strDecscription);
+      }
+//      if (iv_dAccumulatedTime > crclOther.iv_dAccumulatedTime) {
+//         clTmp.iv_dAccumulatedTime = iv_dAccumulatedTime - crclOther.iv_dAccumulatedTime;
+//      }
+      return clTmp;
+    }
+    /*@}*/
+  private:
+    std::string iv_strDecscription;
+  }
+  ; //lint !e1754: Expected symbol 'operator-=' to be declared for class 'Timer' !e1754: Expected symbol 'operator-=' to be declared for class 'Timer'
+
+} // namespace uima
+
+#endif //UIMA_TIMEDATETOOLS_HPP_
+/* <EOF> */
+

Propchange: incubator/uima/uimacpp/trunk/src/framework/uima/timedatetools.hpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/uima/uimacpp/trunk/src/framework/uima/token_properties.hpp
URL: http://svn.apache.org/viewvc/incubator/uima/uimacpp/trunk/src/framework/uima/token_properties.hpp?view=auto&rev=503251
==============================================================================
--- incubator/uima/uimacpp/trunk/src/framework/uima/token_properties.hpp (added)
+++ incubator/uima/uimacpp/trunk/src/framework/uima/token_properties.hpp Sat Feb  3 08:58:54 2007
@@ -0,0 +1,311 @@
+/** \file token_properties.hpp .
+-----------------------------------------------------------------------------
+
+
+
+           (upper, lower, etc.)
+
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+
+-----------------------------------------------------------------------------
+
+    \brief  Contains TokenProperties a class encapsulting information about the characters occuring in a token
+
+   Description:
+
+-----------------------------------------------------------------------------
+
+
+   8/11/00  Initial creation
+
+-------------------------------------------------------------------------- */
+
+#ifndef UIMA_TOKEN_PROPERTIES_HPP
+#define UIMA_TOKEN_PROPERTIES_HPP
+
+/* ----------------------------------------------------------------------- */
+/*       Include dependencies                                              */
+/* ----------------------------------------------------------------------- */
+
+#include "uima/pragmas.hpp" // must be first file to be included to get pragmas
+// extended assert: must be before system includes to make sure our version is used
+#include "uima/assertmsg.h"
+#include "unicode/unistr.h"
+#include "uima/types.h"
+#include <string>
+
+/* ----------------------------------------------------------------------- */
+/*       Constants                                                         */
+/* ----------------------------------------------------------------------- */
+
+/* ----------------------------------------------------------------------- */
+/*       Forward declarations                                              */
+/* ----------------------------------------------------------------------- */
+
+namespace uima {
+#ifndef UIMA_STRPTRLENPAIR_HPP
+  class UnicodeStringRef;
+#endif
+}
+
+/* ----------------------------------------------------------------------- */
+/*       Types / Classes                                                   */
+/* ----------------------------------------------------------------------- */
+
+namespace uima {
+
+  /**
+     The class <TT>TokenProperties</TT> is used to encapsulate information about
+     the characters occuring in a token (for example, upper and lower).
+     At the centre it is a bitset, but with inline member functions
+     for convenient access.
+     This has to be filled by each compliant tokenizer and stored
+     with each token.
+     Example:
+     \code
+     \endcode
+     @see
+  */
+  class UIMA_LINK_IMPORTSPEC TokenProperties {
+  public:
+    /** @name Constructors */
+    /*@{*/
+    /// Constructs an object, initializing all bit values to zero.
+    TokenProperties( void );
+    /// Constructs an object from a UString, computing the bit values for the string.
+    TokenProperties( const icu::UnicodeString & ustrInputString);
+    /// Constructs an object from a UString, computing the bit values for the string.
+    TokenProperties( const UnicodeStringRef & ulstrInputString);
+    /** Constructs an object from a two pointers, computing the bit values for the string.
+     * Note: cpucEnd points beyond the end of the string
+     */
+    TokenProperties(
+      const UChar * cpucCurrent,
+      const UChar * cpucEnd);
+    /**
+     * initializes bits to value of <TT>w32Val</TT>
+     */
+    TokenProperties( WORD32 w32Val );
+    /*@}*/
+    /** @name Properties */
+    /*@{*/
+    /// true if the first char in the token is upper case
+    bool hasLeadingUpper( void ) const;
+    /// sets the <TT>hasLeadingUpper()</TT> property to <TT>bSetOn</TT>
+    void setLeadingUpper( bool bSetOn = true );
+
+    /// true if some char after the first char in the token is upper case
+    bool hasTrailingUpper( void ) const;
+    /// sets the <TT>hasTrailingUpper()</TT> property to <TT>bSetOn</TT>
+    void setTrailingUpper( bool bSetOn = true );
+
+    /// true if the token has upper case chars (leading or trailing)
+    bool hasUpper( void ) const;
+
+    /// true if the token has lower case chars
+    bool hasLower( void ) const;
+    /// sets the <TT>hasLower()</TT> property to <TT>bSetOn</TT>
+    void setLower( bool bSetOn = true );
+
+    /// true if the token has numeric chars
+    bool hasNumeric( void ) const;
+    /// sets the <TT>hasNumeric()</TT> property to <TT>bSetOn</TT>
+    void setNumeric( bool bSetOn = true);
+
+    /// true if the token has special chars (e.g. hyphen, period etc.)
+    bool hasSpecial( void ) const;
+    /// sets the <TT>hasSpecial()</TT> property to <TT>bSetOn</TT>
+    void setSpecial( bool bSetOn = true );
+    /*@}*/
+    /** @name Miscellaneous */
+    /*@{*/
+    /// true if not hasSpecial() and not hasNumeric()
+    bool isPlainWord() const;
+
+    /// true if only hasUpper()
+    bool isAllUppercaseWord( void ) const;
+    /// true if only hasLower()
+    bool isAllLowercaseWord( void ) const;
+    /// true if only hasLeadingUpper() and hasTrailingUpper()
+    bool isInitialUppercaseWord( void ) const;
+    /** true if hasNumeric() && !(hasLower() || hasUpper())
+     *  Note: this might have decimal point and sign
+     */
+    bool isPlainNumber() const;
+
+    /** unlike isPlainNumber() this only allows for digits (no sign and point)
+     */
+    bool isPureNumber() const;
+
+    /** true if hasSpecail() && !(hasLower() || hasUpper() || hasNumeric())
+     *  Note: this might have decimal point and sign
+     */
+    bool isPureSpecial() const;
+
+    /// Resets all bits in *this, and returns *this
+    void reset( void );
+
+    /// Resets all bits and reinitializes from the string
+    void
+    initFromString(
+      const UChar * cpucCurrent,
+      const UChar * cpucEnd
+    );
+
+    /**
+       Returns an object of type string, N characters long.
+       Each position in the new string is initialized with a character
+       ('0' for zero and '1' for one), representing the value stored in the
+       corresponding bit position of this.
+       Character position N - 1 corresponds to bit position 0.
+       Subsequent decreasing character positions correspond to increasing
+       bit positions. */
+    string to_string( void ) const;
+
+    /// Returns the integral value corresponding to the bits in *this.
+    unsigned long to_ulong( void ) const;
+
+    /*@}*/
+  protected:
+    /* --- functions -------------------------------------------------------- */
+    /* --- variables -------------------------------------------------------- */
+  private:
+    /* --- functions -------------------------------------------------------- */
+    /* --- variables -------------------------------------------------------- */
+    WORD32  iv_w32Bits;
+
+  }
+  ; /* TokenProperties */
+
+#define UIMA_TOKEN_PROP_LEADING_UPPER   1
+#define UIMA_TOKEN_PROP_TRAILING_UPPER  2
+#define UIMA_TOKEN_PROP_LOWER           4
+#define UIMA_TOKEN_PROP_NUMERIC         8
+#define UIMA_TOKEN_PROP_SPECIAL        16
+
+  /* ----------------------------------------------------------------------- */
+  /*       Inline Functions                                                  */
+  /* ----------------------------------------------------------------------- */
+
+
+  inline TokenProperties::TokenProperties( void ) :
+      iv_w32Bits(0) {}
+  inline TokenProperties::TokenProperties( WORD32 w32Val ) :
+      iv_w32Bits(w32Val) {}
+  inline bool TokenProperties::hasTrailingUpper( void )  const {
+    return((iv_w32Bits & UIMA_TOKEN_PROP_TRAILING_UPPER) != 0);
+  }
+  inline void TokenProperties::setTrailingUpper( bool bSetOn ) {
+    if (bSetOn) {
+      iv_w32Bits |= UIMA_TOKEN_PROP_TRAILING_UPPER;
+    } else {
+      iv_w32Bits &= (~UIMA_TOKEN_PROP_TRAILING_UPPER);
+    }
+  }
+
+  inline bool TokenProperties::hasLeadingUpper( void ) const {
+    return((iv_w32Bits & UIMA_TOKEN_PROP_LEADING_UPPER) != 0);
+  }
+  inline void TokenProperties::setLeadingUpper( bool bSetOn ) {
+    if (bSetOn) {
+      iv_w32Bits |= UIMA_TOKEN_PROP_LEADING_UPPER;
+    } else {
+      iv_w32Bits &= (~UIMA_TOKEN_PROP_LEADING_UPPER);
+    }
+  }
+  inline bool TokenProperties::hasUpper( void )  const {
+    return((iv_w32Bits & (UIMA_TOKEN_PROP_LEADING_UPPER | UIMA_TOKEN_PROP_TRAILING_UPPER)) != 0);
+  }
+
+  inline bool TokenProperties::hasLower( void ) const {
+    return((iv_w32Bits & UIMA_TOKEN_PROP_LOWER) != 0);
+  }
+  inline void TokenProperties::setLower( bool bSetOn) {
+    if (bSetOn) {
+      iv_w32Bits |= UIMA_TOKEN_PROP_LOWER;
+    } else {
+      iv_w32Bits &= (~UIMA_TOKEN_PROP_LOWER);
+    }
+  }
+
+  inline bool TokenProperties::hasNumeric( void ) const {
+    return((iv_w32Bits & UIMA_TOKEN_PROP_NUMERIC) != 0);
+  }
+  inline void TokenProperties::setNumeric( bool bSetOn ) {
+    if (bSetOn) {
+      iv_w32Bits |= UIMA_TOKEN_PROP_NUMERIC;
+    } else {
+      iv_w32Bits &= (~UIMA_TOKEN_PROP_NUMERIC);
+    }
+  }
+
+  inline bool TokenProperties::hasSpecial( void ) const {
+    return((iv_w32Bits & UIMA_TOKEN_PROP_SPECIAL) != 0);
+  }
+  inline void TokenProperties::setSpecial( bool bSetOn ) {
+    if (bSetOn) {
+      iv_w32Bits |= UIMA_TOKEN_PROP_SPECIAL;
+    } else {
+      iv_w32Bits &= (~UIMA_TOKEN_PROP_SPECIAL);
+    }
+  }
+
+  inline bool TokenProperties::isPlainWord( void ) const {
+    return(   ((iv_w32Bits &  (UIMA_TOKEN_PROP_TRAILING_UPPER | UIMA_TOKEN_PROP_LOWER | UIMA_TOKEN_PROP_LEADING_UPPER)) != 0)
+              && ((iv_w32Bits & ~(UIMA_TOKEN_PROP_TRAILING_UPPER | UIMA_TOKEN_PROP_LOWER | UIMA_TOKEN_PROP_LEADING_UPPER)) == 0));
+  }
+  inline bool TokenProperties::isAllUppercaseWord( void ) const {
+    return(   ((iv_w32Bits &  (UIMA_TOKEN_PROP_TRAILING_UPPER | UIMA_TOKEN_PROP_LEADING_UPPER)) != 0)
+              && ((iv_w32Bits & ~(UIMA_TOKEN_PROP_TRAILING_UPPER | UIMA_TOKEN_PROP_LEADING_UPPER)) == 0));
+  }
+  inline bool TokenProperties::isAllLowercaseWord( void ) const {
+    return(iv_w32Bits  == UIMA_TOKEN_PROP_LOWER);
+  }
+  inline bool TokenProperties::isInitialUppercaseWord( void ) const {
+    return( iv_w32Bits == (UIMA_TOKEN_PROP_LOWER | UIMA_TOKEN_PROP_LEADING_UPPER));
+  }
+  inline bool TokenProperties::isPlainNumber() const {
+    return(   ((iv_w32Bits &  (UIMA_TOKEN_PROP_NUMERIC)) != 0)
+              && ((iv_w32Bits & ~(UIMA_TOKEN_PROP_SPECIAL | UIMA_TOKEN_PROP_NUMERIC)) == 0));
+  }
+  inline bool TokenProperties::isPureNumber() const {
+    return(iv_w32Bits  == UIMA_TOKEN_PROP_NUMERIC);
+  }
+  inline bool TokenProperties::isPureSpecial() const {
+    return(iv_w32Bits == UIMA_TOKEN_PROP_SPECIAL);
+  }
+
+
+  inline void TokenProperties::reset( void ) {
+    iv_w32Bits = 0;
+  }
+
+  inline unsigned long TokenProperties::to_ulong( void ) const {
+    return(unsigned long)iv_w32Bits;
+  }
+
+}
+
+/* ----------------------------------------------------------------------- */
+#endif /* UIMA_TOKEN_PROPERTIES_HPP */
+
+/* <EOF> */
+
+
+
+

Propchange: incubator/uima/uimacpp/trunk/src/framework/uima/token_properties.hpp
------------------------------------------------------------------------------
    svn:eol-style = native