ETSI's Bug Tracker - Part 06: TTCN-3 Control Interface
View Issue Details

ID | Project | Category | View Status | Date Submitted | Last Update
0006337 | Part 06: TTCN-3 Control Interface | Technical | public | 23-11-2012 08:20 | 14-12-2012 07:30

Reporter | Tomas Urban |
Assigned To | Ina Schieferdecker |
Priority | normal | Severity | minor | Reproducibility | have not tried
Status | closed | Resolution | fixed |
Platform |  | OS |  | OS Version |
Product Version | v4.4.1 (published 2012-04) |
Target Version | v4.5.1 (published 2013-04) | Fixed in Version | v4.5.1 (published 2013-04) |
Clause Reference(s) | 10
Source (company - Author) | Elvior

Summary | 0006337: Excess use of const qualifiers in C++ mapping

Description

The current definition of C++ TCI mapping contains several methods where use of const qualifiers is too restrictive. The issue concerns various get methods of constructive value classes and classes for parameter handling.
In case of value classes, it leads to writing an inefficient code. E.g. in order to change an existing value inside a record, one must create a copy of the existing field, set the value in the copy and use the copy to call the setField method.
The most severely affected class is the TciParameterList class, especially if used in extended TRI calls. E.g. in order to set a value of an output parameter of an external functions, the following algorithm has to be used:
1. Get all parameter from the parameter list and store them (the get method of the TciParameterList returns constants)
2. Create a copy of the parameter that will be modified
3. Create a copy of the TCI value object contained in the parameter copy (the getValue method again returns a constant)
4. Modify the value contained in the TCI value object
5. Call the setValue of the parameter object to set the new parameter value
6. Clear the parameter list
7. Use the push_back method to assign the parameter copy and all remaining parameters to the list (the parameter list class doesn't contain a method to change a parameter at a specified index).
It is very clumsy. In my opinion, the algorith should be:
1. Get the parameter be to modified from the list
2. Get the TCI object embedded in the parameter
3. Modify the value
There's of course a good reason, why the const qualifier is used. The affected get methods are (in most cases) allowed in const objects too. It means that the current get methods cannot be simply modified by removing the const qualifier, because that would lead to compilations with existing TCI implementations. Fortunately C++ allows so called const overloading, so it is possible to create methods with the same name, parameters and return values, but different const qualifiers.
Therefore I propose to add the following methods to C++ TCI mapping:
1. To the TciParameter class (10.5.2.9):
virtual TciValue & getValue () = 0;
2. To the TciParameterList class (10.5.2.10):
virtual TciParameter *get (Tindex p_index) = 0;
3. To the RecordValue class (10.5.3.11):
virtual TciValue &getField (const Tstring &p_field_name) = 0;
4. To the RecordOfValue class (10.5.3.12, the current get method shall be removed, because it doesn't work in const objects):
virtual const TciValue & getField (Tindex p_position) const = 0;
virtual TciValue & getField (Tindex p_position) = 0;
5. To the UnionValue class (10.5.3.13):
virtual TciValue & getVariant (const Tstring &p_variantName) = 0;
6. To the AddressValue class (10.5.3.17):
virtual TciValue & getAddress () = 0;

Steps To Reproduce |
Additional Information |
Tags | No tags attached.
Relationships |
Attached Files | CR_6337_v1.docx (136,585) 12-12-2012 08:09 http://oldforge.etsi.org/mantis/file_download.php?file_id=2767&type=bug

Issue History
Date Modified | Username | Field | Change
23-11-2012 08:20 | Tomas Urban | New Issue |
23-11-2012 08:20 | Tomas Urban | Clause Reference(s) | => 10
23-11-2012 08:20 | Tomas Urban | Source (company - Author) | => Elvior
10-12-2012 13:42 | Gyorgy Rethy | Status | new => assigned
10-12-2012 13:42 | Gyorgy Rethy | Assigned To | => Tomas Urban
10-12-2012 16:15 | Gyorgy Rethy | Target Version | => Edition 4.5.1
12-12-2012 08:09 | Tomas Urban | File Added: CR_6337_v1.docx |
12-12-2012 08:10 | Tomas Urban | Note Added: 0011238 |
12-12-2012 08:10 | Tomas Urban | Assigned To | Tomas Urban => Ina Schieferdecker
14-12-2012 07:29 | Ina Schieferdecker | Note Added: 0011260 |
14-12-2012 07:29 | Ina Schieferdecker | Status | assigned => resolved
14-12-2012 07:29 | Ina Schieferdecker | Resolution | open => fixed
14-12-2012 07:29 | Ina Schieferdecker | Fixed in Version | => Edition 4.5.1
14-12-2012 07:30 | Ina Schieferdecker | Status | resolved => closed

Notes

(0011238)
Tomas Urban
12-12-2012 08:10

Proposed resolution attached. Please review.

(0011260)
Ina Schieferdecker
14-12-2012 07:29

Implemented as proposed.