<!--
 === Copyright (c) 1999 The University of Utah and
 === the Computer Systems Laboratory at the University of Utah (CSL).
 === All rights reserved.
 ===
 === Permission to use, copy, modify and distribute this software is hereby
 === granted provided that (1) source code retains these copyright, permission,
 === and disclaimer notices, and (2) redistributions including binaries
 === reproduce the notices in supporting documentation.
 ===
 === THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
 === IS" CONDITION.  THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
 === ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS
 === SOFTWARE.
 ===
 === CSL requests users of this software to return to csl-dist@cs.utah.edu any
 === improvements that they make and grant CSL redistribution rights.
 -->

<!-- TAO CORBA C++ implementation for struct stuff -->

<idl type="struct">

  <pres type="var">
  
    <aliascmd name="T_var()" handler=base::var::'T_var()'>
    <aliascmd name="T_var(T_ptr)" handler=base::var::'T_var(T_ptr)'>
    <aliascmd name="T_var(const T_var &)"
              handler=base::var::'T_var(const T_var &)'>
    <aliascmd name="~T_var()" handler=base::var::'~T_var()'>
    <aliascmd name="T_var &operator=(T_ptr)"
              handler=base::var::'T_var &operator=(T_ptr)'>
    <aliascmd name="T_var &operator=(T_var &)"
              handler=base::var::'T_var &operator=(T_var &)'>
    <aliascmd name="T_ptr operator->()"
              handler=base::var::'T_ptr operator->()'>
    <aliascmd name="const T_ptr operator->() const"
              handler=base::var::'const T_ptr operator->() const'>
    <aliascmd name="operator const T_ptr &() const"
              handler=base::var::'operator const T_ptr &() const'>
    <aliascmd name="operator T_ptr &()"
              handler=base::var::'operator T_ptr &()'>
    <aliascmd name="operator T_ptr &() const"
              handler=base::var::'operator T_ptr &() const'>
    <aliascmd name="in()" handler=base::var::'in()'>
    <aliascmd name="inout()" handler=base::var::'inout()'>
    
    <simple_func kind="out()">
    <if size=="variable">
    <pre><print_func def=c_func inline=true>
    {
      delete this->ptr_;
      this->ptr_ = 0;
      return this->ptr_;
    }
    </pre>
    <else>
    <pre><print_func def=c_func inline=true>
    {
      return *this->ptr_;
    }
    </pre>
    </if>
    </simple_func>
    
    <simple_func kind="_retn()">
    <if size=="variable">
    <pre><print_func def=c_func inline=true>
    {
      <(definition)> *tmp = this->ptr_;
      this->ptr_ = 0;
      return tmp;
    }
    </pre>
    <else>
    <pre><print_func def=c_func inline=true>
    {
      return *this->ptr_;
    }
    </pre>
    </if>
    </simple_func>
    
    <aliascmd name="ptr()" handler=base::var::'ptr()'>
    
  </pres>

  <pres type="out">

    <func kind="T_out(T_ptr &)" inline=true>
      : ptr_(<(parameter[0])>)
    {
      this->ptr_ = 0;
    }
    </func>

    <func kind="T_out(T_var &)" inline=true>
      : ptr_(<(parameter[0])>.out())
    {
      delete this->ptr_;
      this->ptr_ = 0;
    }
    </func>

    <func kind="T_out(T_out &)" inline=true>
      : ptr_(ACE_const_cast(<(out_pointer)>&amp;,<(parameter[0])>).ptr_)
    {}
    </func>

    <func kind="T_out &operator=(const T_out &)" inline=true>
    {
      this->ptr_ = ACE_const_cast(<(out_pointer)>&amp;,<(parameter[0])>).ptr_;
      return *this;
    }
    </func>

    <func kind="T_out &operator=(T *)" inline=true>
    {
      this->ptr_ = <(parameter[0])>;
      return *this;
    }
    </func>

    <func kind="operator T *&()" inline=true>
    {
      return this->ptr_;
    }
    </func>

    <func kind="ptr()" inline=true>
    {
      return this->ptr_;
    }
    </func>

    <func kind="T *operator->()" inline=true>
    {
      return this->ptr_;
    }
    </func>

  </pres>
  
  <pres type="main">
  
    <macro name="do_copy" rparams={ptype:tag_list ptr:bool arg:string}>
    new <(ptype.definition)>(<if ptr>*</if><(arg)>)
    </macro>
    
    <macro name="do_free" rparams={ptype:tag_list arg:string}>
    delete <(arg)>
    </macro>
    
    <macro name="do_access"
           rparams={ptype:tag_list alloc_flag:string slot:string}>
    <if ptype.size=="variable">
    <pre>
    if( <(alloc_flag)> )
      <(slot)> = new <(ptype.definition)>;
    return <(slot)>;</pre>
    <else>
    return &amp;<(slot)>;
    </if>
    </macro>
    
    <aliascmd name="operator<<=(copy)" handler=base::main::'operator<<=(copy)'>
    <aliascmd name="operator<<=(no-copy)"
              handler=base::main::'operator<<=(no-copy)'>
    <aliascmd name="bool operator>>=(any &, ptr &)"
              handler=base::main::'bool operator>>=(any &, ptr &)'>
    
  </pres>

</idl>

<!-- End of file. -->

