home *** CD-ROM | disk | FTP | other *** search
- #line 1 "/fzi/prost/stone/SOS3-2/src/agg/Association.c"
- /* --------------------------------------------------------------------------
- * Copyright 1992 by Forschungszentrum Informatik (FZI)
- *
- * You can use and distribute this software under the terms of the licence
- * you should have received along with this program.
- * If not or if you want additional information, write to
- * Forschungszentrum Informatik, "STONE", Haid-und-Neu-Strasse 10-14,
- * D-7500 Karlsruhe 1, Germany.
- * --------------------------------------------------------------------------
- */
- // **************************************************************************
- // Module Association 06/09/90 Juergen Uhl (ju)
- //
- // **************************************************************************
- // implements methods of classes: Association
- // **************************************************************************
-
- #include "sys.h"
- #include "agg_err.h"
- #include "trc_agg.h"
-
- #include "agg_sos.h"
-
- // **************************************************************************
- sos_Bool _sos_Object_sos_Object_Association::is_role1 (sos_Typed_id &_tpid,sos_Object o)
- // **************************************************************************
- {
- // The function tests if an object is an element of the aggregate.
- // The test may be based on equality or identity, depending on
- // the value of the "role1_based_on_equal" attribute.
-
- T_PROC ("sos_Object_sos_Object_Association::is_role1");
- TT (agg_H, T_ENTER);
-
- sos_Bool result = FALSE;
- sos_Object_sos_Object_Association a = sos_Object_sos_Object_Association::make(_tpid,this);
- sos_Bool based_on_equal = sos_Object_sos_Object_Association::make(_tpid,this).get_role1_based_on_equal();
-
- agg_iterate_association (a, sos_Object role1, sos_Object role2)
- { if (agg_same_entity (o, role1, based_on_equal, EQ_STRONG))
- { result = TRUE;
- break;
- }
- }
- agg_iterate_association_end (a, role1, role2);
-
- TT (agg_H, T_LEAVE);
- return result;
- } // ** is_role1 **
-
- // **************************************************************************
- sos_Bool _sos_Object_sos_Object_Association::is_role2 (sos_Typed_id &_tpid,sos_Object o)
- // **************************************************************************
- {
- // The function tests if an object is an element of the aggregate.
- // The test may be based on equality or identity, depending on
- // the value of the "role2_based_on_equal" attribute.
-
- T_PROC ("sos_Object_sos_Object_Association::is_role2");
- TT (agg_H, T_ENTER);
-
- sos_Bool result = FALSE;
- sos_Object_sos_Object_Association a = sos_Object_sos_Object_Association::make(_tpid,this);
- sos_Bool based_on_equal = sos_Object_sos_Object_Association::make(_tpid,this).get_role2_based_on_equal();
-
- agg_iterate_association (a, sos_Object role1, sos_Object role2)
- { if (agg_same_entity (o, role2, based_on_equal, EQ_STRONG))
- { result = TRUE;
- break;
- }
- }
- agg_iterate_association_end (a, role1, role2);
-
- TT (agg_H, T_LEAVE);
-
- return result;
- } // ** is_role2 **
-