// -*- C++ -*-
#ifndef RIOBJECTBUILDER_H
#define RIOBJECTBUILDER_H
/* Copyright 1996 
 * Mon Jun  2 12:26:51 1997  Brian Smits  (bes@phoenix.cs.utah.edu)
 * 
 * RiObjectBuilder.H
 * 
 *	
 * 
 * $Id: RiObjectBuilder.H,v 1.2 1998/10/02 16:47:45 bes Exp $ 
 * 
 */
#ifndef RICOMMON_H
#include <RiCommon.H>
#endif

//#include <rw/tvordvec.h>


class RiRayObject;

/***************************************************************
CLASS
    RiObjectBuilder
     Base class for all primitive builders.

DESCRIPTION
     This class encapsulates building objects.  It maintains the lists of various
     types of objects that are being built, as well as a global list of objects that
     can and should be deleted when the model is finished.  Users get the built objects
     out of the builder by calling the various Get routines for the types being built.
     The user passes into the constructor the OR'd flags describing which type of objects
     should be built (Ray, Rad, Display....)

USING BUILD AND RESET:
     Calling build appends the new objects to the previously built objects.
     Once the objects have been taken out of the builder, the user should
     call reset.  This allows builders to be passed into readers and accumulate all
     geometry.  Once the reader is finished, the builders can be querried for everything
     that was built.

****************************************************************/

class RiObjectBuilder {
  public:
				//// enumeration of the possible products, used to determine what to build.
    enum Products {noneFlag = 0, rayFlag = 1, radFlag = 2, displayFlag = 4};
				// GROUP: Constructors and assignment
				//// Default Constructor
    RiObjectBuilder(Products wanted = rayFlag);
				//// Destructor
    virtual ~RiObjectBuilder();
				// GROUP: Accessors
    				////
    int         	 GetNumRayObjects() const;
				////
    RiRayObject 	*GetRayObject(int i) const;
				// GROUP: Members
				//// Builds all objects wanted.  It should reset the builder to
				// a state where it can accept new data and build more objects.
    virtual bool 	 Build() = 0;
				//// Resets the accumulated lists of built objects.
    void 		 Reset();
  protected:
				// GROUP: Accessors for Derived classes
				//// should be called by Build to see if if RiRayObject should be built.
    bool		 WantRayObjects() const;
				//// Add another built RiRayObject.
    void AddRayObject(RiRayObject *obj);

  private:
				// GROUP: Unimplemented
				////Copy Constructor Not Implemented
    RiObjectBuilder(const RiObjectBuilder &);
				//// Assignment Not Implemented
    RiObjectBuilder &operator=(const RiObjectBuilder &);
				// GROUP: Data
				//// List of RiRayObject
//    RWTValOrderedVector<RiRayObject *>  rayObjs;
    RiRayObject     **rayObjs;
				////
    int len, arrayLen;
				//// Flags describing which products are wanted.
    Products  wantedProducts;
};



/*

      				////
    int         	 GetNumRadObjects() const;
				////
    RiRadObject 	*GetRadObject(int i) const;

				//// should be called by Build to see if if RiRayObject should be built.
    bool		 WantRadObjects() const;
				//// Add another built RiRayObject.
    void AddRadObject(RiRadObject *obj);

				//// List of RiRadObject
    RWTValOrderedVector<RiRadObject *>  radObjs;
*/

#endif /* RIOBJECTBUILDER_H */

