|
From: Chris M. <zm...@us...> - 2002-02-27 22:22:08
|
Update of /cvsroot/kuml/kuml/libkuml/test_client
In directory usw-pr-cvs1:/tmp/cvs-serv19874
Modified Files:
Makefile test_client.cc
Log Message:
Mods for change to UML 1.4
Index: Makefile
===================================================================
RCS file: /cvsroot/kuml/kuml/libkuml/test_client/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** Makefile 16 Oct 2000 04:07:37 -0000 1.1.1.1
--- Makefile 27 Feb 2002 22:22:03 -0000 1.2
***************
*** 1,9 ****
! MICO_VERSION=2.3.0
! test_client: test_client.o ../uml/Foundation/Foundation.o ../uml/Reflective/Reflective.o
! mico-ld -o test_client test_client.o ../uml/Foundation/Foundation.o ../uml/Reflective/Reflective.o -lmico${MICO_VERSION} -lmicocoss${MICO_VERSION}
!
! test_client.o: test_client.cc ../uml/Foundation/Foundation.h ../uml/Reflective/Reflective.h ../uml/Foundation/sequence_extensions.h
! mico-c++ -c -g -I../uml/Foundation -I../uml/Reflective test_client.cc
clean:
--- 1,7 ----
! test_client: test_client.o ../uml/Core/Core.o ../uml/Reflective/Reflective.o ../uml/UML/UML.o
! mico-ld -o test_client test_client.o ../uml/Core/Core.o ../uml/Reflective/Reflective.o ../uml/UML/UML.o ../uml/CommonBehavior/CommonBehavior.o ../uml/StateMachines/StateMachines.o ../uml/Collaborations/Collaborations.o ../uml/UseCases/UseCases.o ../uml/ActivityGraphs/ActivityGraphs.o ../uml/ModelManagement/ModelManagement.o ../uml/DataTypes/DataTypes.o -lmico${MICOVERSION} -lmicocoss${MICOVERSION}
! test_client.o: test_client.cc ../uml/Core/Core.h ../uml/Reflective/Reflective.h ../uml/UML/UML.h ../uml/Core/sequence_extensions.h
! mico-c++ -c -g -I../uml/Core -I../uml/Reflective -I../uml/UML -I../uml/CommonBehavior -I../uml/StateMachines -I../uml/Collaborations -I../uml/UseCases -I../uml/ActivityGraphs -I../uml/ModelManagement -I../uml/DataTypes test_client.cc
clean:
Index: test_client.cc
===================================================================
RCS file: /cvsroot/kuml/kuml/libkuml/test_client/test_client.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** test_client.cc 20 Dec 2000 20:37:16 -0000 1.2
--- test_client.cc 27 Feb 2002 22:22:03 -0000 1.3
***************
*** 1,5 ****
#include <CORBA-SMALL.h>
#include <mico/CosNaming.h>
! #include "Foundation.h"
#include "sequence_extensions.h"
--- 1,6 ----
#include <CORBA-SMALL.h>
+ #include <mico/types.h>
#include <mico/CosNaming.h>
! #include "UML.h"
#include "sequence_extensions.h"
***************
*** 15,20 ****
CosNaming::Name name;
name.length (1);
! name[0].id = CORBA::string_dup ("fcCoreFactory");
! name[0].kind = CORBA::string_dup ("UmlCoreFactory");
CORBA::Object_var obj;
--- 16,21 ----
CosNaming::Name name;
name.length (1);
! name[0].id = CORBA::string_dup ("fcUMLPackageFactory");
! name[0].kind = CORBA::string_dup ("UMLPackageFactory");
CORBA::Object_var obj;
***************
*** 37,53 ****
printf("found factory\n");
! Foundation::FoundationPackageFactory_var factory =
! Foundation::FoundationPackageFactory::_narrow( obj );
! Foundation::FoundationPackage_var foundPkg =
! factory->create_foundation_package();
assert (! CORBA::is_nil (foundPkg));
! Foundation::Core::CorePackage_var corePkg = foundPkg->core_ref();
printf("new core object created\n");
! Foundation::Core::ClassClass_var cc = corePkg->class_ref();
assert (! CORBA::is_nil (cc));
--- 38,56 ----
printf("found factory\n");
! UML::UMLPackageFactory_var factory =
! UML::UMLPackageFactory::_narrow( obj );
! UML::UMLPackage_var foundPkg =
! factory->create_uml_package();
assert (! CORBA::is_nil (foundPkg));
! Core::CorePackage_var corePkg = foundPkg->core_ref();
printf("new core object created\n");
! assert (! CORBA::is_nil (corePkg));
!
! Core::ClassClass_var cc = corePkg->class_ref();
assert (! CORBA::is_nil (cc));
***************
*** 57,63 ****
printf("calling create class\n");
! Foundation::Core::Class_var myClass = cc->create_class(
! (const char *)"MyFirstClass",
! Foundation::DataTypes::vk_public, // Vis
FALSE, // is spec
TRUE, // is root?
--- 60,76 ----
printf("calling create class\n");
! char *the_class_name = "MyFirstClass";
! MICO_ULong maxval = 1;
! MICO_ULong lengthval = 1;
! const Core::NameBag the_class_name_bag =
! Core::NameBag(maxval, lengthval, &the_class_name, FALSE);
!
! DataTypes::VisibilityKind class_viskinds[] = {DataTypes::vk_public};
! const Core::VisibilityKindBag the_class_viskind_bag =
! Core::VisibilityKindBag(1, 1, class_viskinds, FALSE);
!
! Core::Class_var myClass = cc->create_class(
! the_class_name_bag, // name
! the_class_viskind_bag, // Vis
FALSE, // is spec
TRUE, // is root?
***************
*** 66,76 ****
FALSE); // is active
! Foundation::DataTypes::Name_var foundName = myClass->name();
! printf("created class named %s\n", (char *)foundName);
printf("and is_leaf attribute set to %d\n", myClass->is_leaf());
! Foundation::Core::ClassSet_var all_classes = cc->all_of_type_class();
MICO_ULong len = all_classes->length();
--- 79,90 ----
FALSE); // is active
! DataTypes::Name_var foundName = myClass->name();
! printf("created class named ");
! printf("%s\n", foundName.in());
printf("and is_leaf attribute set to %d\n", myClass->is_leaf());
! Core::ClassSet_var all_classes = cc->all_of_type_class();
MICO_ULong len = all_classes->length();
***************
*** 79,90 ****
for(MICO_ULong i = 0; i < len; i++)
! { Foundation::Core::Class_var& foundClass = all_classes[i];
! Foundation::DataTypes::Name foundName = foundClass->name();
! printf("found class %s at index %d\n", (char *)foundName, i);
}
! Foundation::Core::ModelElementClass_var mec = corePkg->model_element_ref();
! Foundation::Core::ModelElementSet_var all_MEs = mec->all_of_type_model_element();
len = all_MEs->length();
--- 93,104 ----
for(MICO_ULong i = 0; i < len; i++)
! { Core::Class_var& foundClass = all_classes[i];
! DataTypes::Name foundCName = foundClass->name();
! printf("found class %s at index %d\n", foundCName, i);
}
! Core::ModelElementClass_var mec = corePkg->model_element_ref();
! Core::ModelElementSet_var all_MEs = mec->all_of_type_model_element();
len = all_MEs->length();
***************
*** 93,136 ****
for(MICO_ULong j = 0; j < len; j++)
! { Foundation::Core::ModelElement_var& foundME = all_MEs[j];
! Foundation::DataTypes::Name foundName = foundME->name();
! printf("found model elements %s at index %d\n", foundName, j);
}
// Create an attribute (ah!)
! Foundation::Core::UmlAttributeClass_var uac = corePkg->uml_attribute_ref();
! Foundation::DataTypes::Name_var java = CORBA::string_dup("Java");
! CORBA::String_var body = CORBA::string_dup("");
! Foundation::DataTypes::Multiplicity mult;
! Foundation::DataTypes::MultiplicityRange single;
! single.lower = 1;
! single.upper = 1;
! insert_elem(mult, single);
! Foundation::DataTypes::Expression init = {java, body};
! Foundation::Core::UmlAttribute_ptr ua = uac->create_uml_attribute(
! (const char *)"My First Attribute", // name
! Foundation::DataTypes::vk_public, // Vis
! FALSE, // is_specification
! Foundation::DataTypes::sk_instance, // owner_scope
! mult, // multiplicity
! Foundation::DataTypes::ck_changeable, // changeability
! Foundation::DataTypes::sk_instance, //target_scope
! init); // initial_value
! printf("attibute created\n");
// This is insufficient!
// myClass->add_feature(ua);
! Foundation::Core::AOwnerFeature_ptr owned_feature_assoc =
corePkg->a_owner_feature_ref();
owned_feature_assoc->add(myClass, ua);
return 0;
--- 107,219 ----
for(MICO_ULong j = 0; j < len; j++)
! { Core::ModelElement_var& foundME = all_MEs[j];
! DataTypes::Name_var foundName = foundME->name();
! printf("found model elements %s at index %d\n", foundName.in(), j);
}
// Create an attribute (ah!)
! Core::UmlAttributeClass_var uac = corePkg->uml_attribute_ref();
!
! char *the_attr_name = "My First Attribute";
! const Core::NameBag the_attr_name_bag =
! Core::NameBag(1, 1, &the_attr_name, FALSE);
!
! DataTypes::VisibilityKind attr_viskinds[] = {DataTypes::vk_public};
! const Core::VisibilityKindBag the_attr_viskind_bag =
! Core::VisibilityKindBag(1, 1, attr_viskinds, FALSE);
!
! DataTypes::DataTypesPackage_var dataPkg = foundPkg->data_types_ref();
!
! DataTypes::MultiplicityClass_var mc = dataPkg->multiplicity_ref();
!
! DataTypes::Multiplicity_ptr mults = mc->create_multiplicity();
!
! DataTypes::MultiplicityRangeClass_var mrc = dataPkg->multiplicity_range_ref();
!
! DataTypes::MultiplicityRange_ptr mr = mrc->create_multiplicity_range(1, 1);
!
! mults->add_range(mr);
!
! const Core::MultiplicityBag the_attr_mult_bag =
! Core::MultiplicityBag(1, 1, &mults, FALSE);
!
! DataTypes::ChangeableKind ck = DataTypes::ck_changeable;
!
! Core::ChangeableKindBag ckb = Core::ChangeableKindBag(1, 1, &ck, FALSE);
!
! DataTypes::ScopeKind sk = DataTypes::sk_instance;
! Core::ScopeKindBag skb = Core::ScopeKindBag(1, 1, &sk, FALSE);
! DataTypes::OrderingKind ok = DataTypes::ok_unordered;
! Core::OrderingKindBag okb = Core::OrderingKindBag(1, 1, &ok, FALSE);
! DataTypes::ExpressionClass_var ec = dataPkg->expression_ref();
! char *lang_name = "Java";
! const DataTypes::NameBag lang_name_bag =
! DataTypes::NameBag(1, 1, &lang_name, FALSE);
! // const char body[] = " ";
! CORBA::String_var body = CORBA::string_dup("");
! DataTypes::Expression_ptr ex =
! ec->create_expression(lang_name_bag, body.in());
!
! Core::ExpressionBag eb = Core::ExpressionBag(1, 1, &ex, FALSE);
!
! Core::UmlAttribute_ptr ua = uac->create_uml_attribute(
! the_attr_name_bag, // const Core::NameBag& name
! the_attr_viskind_bag, // const Core::VisibilityKindBag& visibility
! FALSE, // CORBA::Boolean is_specification
! DataTypes::sk_instance, // DataTypes::ScopeKind owner_scope
! the_attr_mult_bag, // const Core::MultiplicityBag& multiplicity
! ckb, // const Core::ChangeableKindBag& changeability
! skb, // const Core::ScopeKindBag& target_scope
! okb, // const Core::OrderingKindBag& ordering
! eb); // const Core::ExpressionBag& initial_value
!
! printf("attribute created\n");
// This is insufficient!
// myClass->add_feature(ua);
! Core::AOwnerFeature_ptr owned_feature_assoc =
corePkg->a_owner_feature_ref();
owned_feature_assoc->add(myClass, ua);
+
+ printf("created link between attribute and class\n");
+
+ // Create a tagged value.
+ Core::TaggedValueClass_var tvc = corePkg->tagged_value_ref();
+
+ char *the_tag_name = "Persistent";
+ const Core::NameBag the_tag_name_bag =
+ Core::NameBag(1, 1, &the_tag_name, FALSE);
+
+ DataTypes::VisibilityKind tag_viskinds[] = {DataTypes::vk_public};
+ const Core::VisibilityKindBag the_tag_viskind_bag =
+ Core::VisibilityKindBag(1, 1, tag_viskinds, FALSE);
+
+ char *the_tag_value = "true";
+ const Core::StringSet the_tag_value_bag =
+ Core::StringSet(1, 1, &the_tag_value, FALSE);
+
+ Core::TaggedValue_ptr tv = tvc->create_tagged_value(
+ the_tag_name_bag, // const Core::NameBag& name
+ the_tag_viskind_bag, // const Core::VisibilityKindBag& visibility
+ FALSE, // CORBA::Boolean is_specification
+ the_tag_value_bag); // const Core::StringSet& data_value
+
+ printf("created tagged value\n");
+
+ CORBA::String_var the_new_tag = CORBA::string_dup("hello.txt");
+ tv->add_data_value(the_new_tag);
+
+ Core::StringSet_var ss = tv->data_value();
+ for (int i =0; i < ss->length(); i++)
+ printf("tag %d : %s\n", i, ss[i].in());
return 0;
|