File: objarg.sidl

package info (click to toggle)
babel 0.10.2-1
  • links: PTS
  • area: contrib
  • in suites: sarge
  • size: 43,932 kB
  • ctags: 29,707
  • sloc: java: 74,695; ansic: 73,142; cpp: 40,649; sh: 18,411; f90: 10,062; fortran: 6,727; python: 6,406; makefile: 3,866; xml: 118; perl: 48
file content (131 lines) | stat: -rw-r--r-- 4,296 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
//
// Copyright (c) 2001, The Regents of the University of Calfornia.
// Produced at the Lawrence Livermore National Laboratory.
// Written by the Components Team <components@llnl.gov>
// UCRL-CODE-2002-054
// All rights reserved.
// 
// This file is part of Babel. For more information, see
// http://www.llnl.gov/CASC/components/. Please read the COPYRIGHT file
// for Our Notice and the LICENSE file for the GNU Lesser General Public
// License.
// 
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License (as published by
// the Free Software Foundation) version 2.1 dated February 1999.
// 
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
// conditions of the GNU Lesser General Public License for more details.
// 
// You should have recieved a copy of the GNU Lesser General Public License
// along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

package objarg version 0.5 { 

  /**
   * This object type holds the basic information about an employee:
   * name, age, salary and marital status.  This object exists purely
   * to serve as a test case for sidl.  It is not intended for serious
   * use.
   */
  class Employee { 

    /**
     * Provide the data for the employee object to hold.
     * <code>false</code> is returned when the data was unacceptable.
     * <code>true</code> means the employee object was successfully
     * initialized.
     */
    bool init( in string name, in int age, in float salary, in char status );

    /**
     * Change the name of an employee.
     */
    void setName( in string name );
    /**
     * Return the name of an employee.
     */
    string getName();

    /**
     * Change the age of an employee.
     */
    void setAge( in int age );
    /**
     * Return the age of an employee.
     */
    int getAge();

    /**
     * Set an employee's salary.
     */
    void setSalary( in float salary );
    /**
     * Return an employee's salary.
     */
    float getSalary();

    /**
     * Set an employee's marital status.
     */
    void setStatus( in char status );
    /**
     * Return an employee's marital status.
     */
    char getStatus();
  };

  /**
   * This class manages a collection of employees.
   */  
  class EmployeeArray {     // indexed from 1..(length)

    /**
     * Return the number of employees in the employee array.
     */
    int getLength();       

    /**
     * Return the employee in position <code>index</code> where
     * <code>index</code> ranges from 1 to the length of the array.
     * If <code>index</code> is outside the range of the array (i.e.
     * less than or equal to zero or greater than the current number
     * of elements in the array), this method returns a NULL
     * employee object.
     */
    Employee at( in int index );  

    /**
     * Add an employee onto the end of the array.  It is perfectly
     * legal to add the same employee multiple times.
     * <code>true</code> is returned when the append was successful;
     * otherwise, <code>false</code> is returned to indicate
     * failure.  This method will not add a NULL employee.
     */
    bool appendEmployee( in Employee e );

    /**
     * Find the first employee in the array that has a name matching
     * <code>name</code>.  If a match exists, the index is returned,
     * and the employee is returned in parameter <code>e</code>.
     *
     * If no match exists, 0 is returned, and <code>e</code> is NULL.
     */
    int findByName( in string name, out Employee e );

    /**
     * Determine the maximum salary in the array. If the maximum
     * salary in the array is greater than the current salary of
     * <code>e</code>, the salary of <code>e</code> will be 
     * increased to the maximum salary in the array.  If the
     * array is empty, no change will be made to <code>e</code>.
     *
     * This method returns <code>true</code> iff the salary of
     * <code>e</code> is modified.
     */
    bool promoteToMaxSalary( inout Employee e );    
  };
};