// Copyright 2020 Siemens Digital Industries Software // ================================================== // Copyright 2011. // Siemens Product Lifecycle Management Software Inc. // All Rights Reserved. // ================================================== // Copyright 2020 Siemens Digital Industries Software /** EquivalenceService.hxx file describing the interface for EquivalenceService. */ #ifndef TC_AC_EQUIVALENCE_SERVICE_INTERFACE_H #define TC_AC_EQUIVALENCE_SERVICE_INTERFACE_H #include #include #include #include #include #include #include namespace Teamcenter { class EquivalenceCriteria; class EquivalenceService; typedef int (*Equivalence_criteria_creator_fn_t)(const EquivalenceService*, EquivalenceCriteria **); struct FCLASSES_API EquivalenceServiceInfo { std::string sourceClosureRule; std::string targetClosureRule; int srcDepth;//-1 means none int targetDepth;// -1 means none bool bSrcExpanded; bool bTargetExpanded; bool bForceTargetExpand; std::set criteria;//disallow duplicates std::vector srcScopeNodes; std::vector targetScopeNodes; tag_t srcContextObj; tag_t targetContextObj; EquivalenceServiceInfo():srcDepth(-1),targetDepth(-1),bSrcExpanded(false),bTargetExpanded(false),bForceTargetExpand(false), srcContextObj(NULLTAG), targetContextObj(NULLTAG) { } }; /** Defines maps in which key is representation of a type of property or any equivalence criteria and the value is comma separated list of property names or criteria names or attribute IDs.
The maps are used for passing different types of properties like Attribute group, Managed Attribute Group,Basic through appropriate representation of keys like Mfg0attribute_groups, Mfg0properties.
This can be used for any such applications like 4gd. */ struct FCLASSES_API EquivalenceServiceInfo2 { std::map > m_additionalCriteria; /**< Map of type of property to vector of property names */ std::map > m_additionalCriteriaInt; /**< Map of type of property to vector of property IDs */ std::map > m_additionalCriteriaDbl; /**< Map of type of property to vector of property IDs */ std::map > m_additionalCriteriaObj; /**< Map of type of Business Object to vector of objects */ }; class FCLASSES_API EquivalenceService { public: virtual ~EquivalenceService(); //getEquivalent objects between 2 structures, while expanding them using the closure rules provided. //The expansion starts at each srcScope and targetScope. Output is a map of src tag to its� // set of equivalent target nodes. Any previous data will be cleared and reinitialized. //PRE:must supply the source and targetScopes and the closure rules. The depth should be set to -1 if unused. // Otherwise, they have to indicate how many levels below each scope line the traversal has to proceed. // Criteria names must be names registered with install_callback ( the last argument ). // If bForceExpandTarget is true - target will be expanded. If false, target is may or maynot be expanded // and the target closure rule will be used to see if a target line instantiated is reachable. //POST: Any equivalent lines are returned as a map - the key is the src node, and value is a set of equivalent target nodes. //Return: ErrorCode. virtual int getEquivalentNodes(const std::vector &srcScopes, const std::string& closureRuleName, const std::vector& targetScopes, const std::string& targetClosureRuleName, const std::set &criteriaNames, int srcDepth, int targetDepth, bool bForceTargetExpand, std::map > & targetMatches, std::map > * srcMatches=0, tag_t srcCtxt=NULLTAG,/* in cases like cdp - this can be the subset tag.*/ tag_t targetCtxt=NULLTAG/*in case it is needed for some future cases.*/ ) =0; //Same as above - except the source is already expanded (expandedSrcNodes). virtual int getEquivalentNodes(const std::set & expandedSrcNodes, const std::vector& targetScopes, const std::string& targetClosureRuleName, const std::set &criteriaNames, bool bForceTargetExpand, int targetDepth, std::map > & targetMatches, std::map > * srcMatches=0, tag_t srcCtxt=NULLTAG,/* in cases like cdp - this can be the subset tag.*/ tag_t targetCtxt=NULLTAG/*in case it is needed for some future cases.*/)=0; //To be used when both the source and target structures are already expanded. virtual int getEquivalentNodes(const std::set & expandedSrcNodes, const std::set & expandedTargetNodes, const std::set &criteriaNames, std::map > & targetMatches, std::map > * srcMatches=0, tag_t srcCtxt=NULLTAG,/* in cases like cdp - this can be the subset tag.*/ tag_t targetCtxt=NULLTAG/*in case it is needed for some future cases.*/)=0; //To be used when both the source is expanded, but target is not. In this case // target expansion will be a side effect of finding equivalences using the supplied criteria (ID in conext - top level) // Very rare usage. virtual int getEquivalentNodes(const std::vector &srcScopes, const std::string& closureRuleName, const std::vector & targetScopes, int srcDepth, const std::set &criteriaNames, std::map > & targetMatches, std::map > * srcMatches=0, tag_t srcCtxt=NULLTAG,/* in cases like cdp - this can be the subset tag.*/ tag_t targetCtxt=NULLTAG/*in case it is needed for some future cases.*/)=0; //To be used when the source is expanded, but target is not. In this case // target expansion will be a side effect of finding equivalences using the supplied criteria // (eg: ID in conext - top level) virtual int getEquivalentNodes(const std::set &/*srcNodes*/, const std::vector & /*targetScopes*/, const std::set &/*criteriaNamesv*/, std::map > & /*targetMatches*/, std::map > * /*srcMatches*/=0, tag_t srcCtxt=NULLTAG,/* in cases like cdp - this can be the subset tag.*/ tag_t targetCtxt=NULLTAG/*in case it is needed for some future cases.*/)=0; /** Retrieves the Equivalent Nodes when the source is expanded but the target is not. @returns
  • #ITK_ok on success.
  • #RLZ0REALIZATION_invalid_input if @p srcNodes or @p tgtScopes is invalid.
  • #MDL0MODEL_null_tag if @p srcNodes or @p tgtScopes is #NULLTAG.
  • #COLLABCTX_no_property_specified_for_comparison if no property is specified for comparison in the map @p additionalCriteria.
  • #COLLABCTX_invalid_property_for_object_type if the properties specified in the map @p additionalCriteria are invalid.
*/ virtual int getEquivalentNodes( const std::set & srcNodes, /**< (I) The source nodes */ const std::vector & tgtScopes, /**< (I) The targets scopes */ const std::set & criteriaNames, /**< (I) The criteria names */ std::map > & tgtMatch, /**< (O) The targets matching each input source */ std::map > * srcMatch = 0, /**< (O) The matching sources to each target */ std::map > * additionalCriteria=0, /**< (I) A map of property type to list of properties */ tag_t srcCtxt=NULLTAG, /**< (I) The Source Context */ tag_t targetCtxt=NULLTAG, /**< (I) The Target Context. */ int targetDepth=0 /**< (I) The Target depth to represent the level of target structure. */ )=0; //Returns all the lines that are expanded in src structure. //PRE: one of the getEquivalentNodes method should have been called. If not expanded already - will expand the source structure // if a closureRule was passed in, or if closure rule service can expand based on context (eg: cpd expansion). //POST: return any lines expanded in the source structure. Note for non-closure rule mode and not any structure expansion // understood by mfg layer expansion ( like cpd) - this will return empty set. virtual int getExpandedSrcNodes(std::set& nodes) =0; //This returns all the lines expanded in the target ( if passed in - that list is returned, else // if targetclosure rule was used - only those expanded using that closure rule are returned. // This is to avoid needless target expansion for performance reasons.) // This may not be needed, unless there are special cases - like the case of finding missing in src. // If such a case arises, the caller would then call findTargetInSource repeatedly for each line returned here. //PRE: one of the getEquivalentMethods should have been called. //POST: if expanded lines are passed in - there are returned, else if a closure rule was provided - will expand // using that (if not done already) and return those lines. The caller must be careful in calling this - as it will // always expand target. If caller does not want it to be expanded - should use their own partial expand mechanisms // instead of calling this method. virtual int getExpandedTargetNodes(std::set& nodes ) =0; virtual int getEquivalenceParameters(EquivalenceServiceInfo& info) const = 0; /** Retrieves the results of the criteria as defined in the provided structure. @returns
  • #ITK_ok on success.
  • #COLLABCTX_no_property_specified_for_comparison if no property is specified for comparison in the criteria of the structure @p info2.
  • #COLLABCTX_invalid_property_for_object_type if the properties specified in the criteria of the structure @p info2 are invalid.
*/ virtual int getEquivalenceParameters( EquivalenceServiceInfo2& info2 /**< (IO) The results of the criteria as defined in the provided structure */ ) const = 0; virtual int populateTargetNodes(std::set &) = 0; // SPECIAL BEHAVIOR: Not to be used by normal callers. Special case. // To be used when both source and target structures are already expanded. // This method is not meant to clear any prior data. It is meant to reuse // some of the data from the existing service and create a new instance of // equivalenceService and get results. The input src and targetNodes will // not be the same as the original service object. This is to be used in those // rare cases where the registration does not allow client to register more than // than one equivalence service. virtual int getEquivalentNodes(const std::set & expandedSrcNodes, const std::set & expandedTargetNodes, std::map > & targetMatches, std::set* missingInTarget=0, std::set* missingInSrc=0, std::map > * srcMatches=0, const std::set *criteriaNames=0, tag_t srcCtxt=NULLTAG,/* in cases like cdp - this can be the subset tag.*/ tag_t targetCtxt=NULLTAG/*in case it is needed for some future cases.*/)=0; }; } #include #endif