
/*  o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o

    CTool Library
    Copyright (C) 1998-2001	Shaun Flisakowski

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 1, or (at your option)
    any later version.

    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
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

    o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o  */

/*  o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o
    o+
    o+     File:         dup.h
    o+
    o+     Programmer:   Patrick Baudin
    o+     Date:         Aug 10, 2000
    o+
    o+     A high level Dup declaration.
    o+
    o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o  */

#ifndef CT_DUP_H
#define CT_DUP_H

template <class R> class Dup {
  public:
    virtual ~Dup() {}
    
    // Virtual deep-copy method; 
    // so it can't be applied to a NULL pointer. 
    virtual R * dup0 (void) const = 0 ;
    
    // Nonvirtual deep-copy (calling the virtual one)
    // such that it can be applied to a NULL pointer.
    R * dup (void) const { return this ? dup0() : (R *) NULL ; } ;
    
} ;

#endif
