1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2000-2015 Ericsson Telecom AB
3 // All rights reserved. This program and the accompanying materials
4 // are made available under the terms of the Eclipse Public License v1.0
5 // which accompanies this distribution, and is available at
6 // http://www.eclipse.org/legal/epl-v10.html
7 ///////////////////////////////////////////////////////////////////////////////
12 #ifdef TITAN_RUNTIME_2
14 /** This class contains the functions needed for adding and removing referenced
15 * indexes to record of/set of types and the optional type (only in RT2).
16 * By default the functions are empty.*/
17 class RefdIndexInterface
20 virtual ~RefdIndexInterface() {}
21 virtual void add_refd_index(int) {}
22 virtual void remove_refd_index(int) {}
25 /** References to record of/set of elements through 'out' and 'inout' function
26 * parameters are handled by this class.
27 * Usage: create instances of this class before the function call (one instance
28 * for each referenced index), and place the instances and the function call in
29 * a block (so the destructor is called immediately after the function call).
30 * This way the referenced indexes are cleaned up even if the function call ends
31 * with an exception (DTE) */
32 class RefdIndexHandler
35 RefdIndexHandler(RefdIndexInterface* p_container, int p_index)
37 container = p_container;
39 container->add_refd_index(index);
44 container->remove_refd_index(index);
48 RefdIndexInterface* container;
52 #endif /* TITAN_RUNTIME_2 */
54 #endif /* REFDINDEX_HH */