axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adrian Dick (JIRA)" <axis-c-...@ws.apache.org>
Subject [jira] Commented: (AXISCPP-228) getter and setter methods should be generated as the Java version do
Date Thu, 03 Feb 2005 11:32:17 GMT
     [ http://issues.apache.org/jira/browse/AXISCPP-228?page=comments#action_58552 ]
     
Adrian Dick commented on AXISCPP-228:
-------------------------------------

Fixing this issue could provide a (simpler) mechanism to support xsd:choice and validating
minOccurs and MaxOccurs, it may also provide a neater solution for handling nillable elements.

Current Jira Issues in this area include: AXISCPP-250 and AXISCPP-257.

To support xsd:choice
- An enum is created containing all possible choices.
- The generated class contains a union of the elements available within the choice, and a
tag for the enum.
- set<...> methods are provided for all possible choices, each will set the approiate
element, and update tag for the given choice.
- get<...> methods are provided for all possible choices, and a getChoiceType method,
returning the tag, allowing customer code to use correct get<...> method.

eg:
typedef enum { CHOICE1=1, CHOICE2=1} availableChoices;
class ChoiceWrapper
{
public:
 void setChoice1(... value)
 {
  choice1 = value;
  choice = CHOICE1;
 };
 void setChoice2(... value);
 ... getChoice1();
 ... getChoice2()
 { return choice2; };
 availableChoices getChoice()
 { return choice; };
private:
 availableChoices choice = 0;
 union
 {
  ... choice1;
  ... choice2;
 } choices;
}

To support minOccurs and MaxOccurs:
- If maxOccurs > 1, provide an add<...> method, which when called will update a count
of occurances of elements.
- If maxOccurs = 1, can do as above, or alternatively, provide a set<...> method, again
updating a count of elements.
- Provide a <...>Occurances method, to allow customers to determine how many element
they have.

eg:
class OccurancesWrapper
{
public:
 addValue(... addValue)
 {
  if (valueOccurances != valueMaxOccurs)
  {
   value[valueOccurances] = addValue;
   valueOccurances++;
  }
  else
    throw new AxisException(EXCEEDING_MAX_OCCURS);
 };
 int getValueOccurances()
 { return valueOccurances; };
 ... getValue(int occurance)
 { return value[occurance]; };
private:
 ... value[valueMaxOccurances];
 int valueOccurances = 0;
 const int valueMaxOccurs = 2;
 const int valueMinOccurs = 0;
}
Axis_Serialize_OccurancesWrapper()
{
 // ...
 if ( valueOccurances < valueMinOccurs)
   throw new AxisException(LESS_THAN_MIN_OCCURS);
 if (valueOccurances != 0)
   pSZ->serialize....();
 // ...
}

> getter and setter methods should be generated as the Java version do
> --------------------------------------------------------------------
>
>          Key: AXISCPP-228
>          URL: http://issues.apache.org/jira/browse/AXISCPP-228
>      Project: Axis-C++
>         Type: Wish
>   Components: WSDL processing
>     Versions: 1.5 Alpha
>     Reporter: Geir Egil Hansen
>     Assignee: Samisa Abeysinghe
>     Priority: Minor

>
> data hiding is of importance in C++ as well as in Java. So I should wish Axis C++ can
generate getter and setter methods for the data members the same way as the Java version does

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


Mime
View raw message