////////////////////////////////////////
// Start of File: C1_DGROU.HPP
////////////////////////////////////////

#ifndef C1_DGROU_HPP            // Avoid multiple includes...
#define C1_DGROU_HPP    TRUE    // ...holds to a terminal #endif below...

//===================================================================
//
// COPYRIGHT NOTICE:  This code is protected by Copyright!
//
// Copyright (c) 1994, 1995, 1996, 1997 by DPC Technology.
// All rights reserved. 
//
// See files "cf_copyr.txt" and "cf_licen.txt" for details of 
// copyright and license specifications, and contact information.
//
//===================================================================

//
// Master Header File Listing:
//
// #include    <cf_api/c1_dgrou.hpp>
// Chart Framework "Data Group (of XYZ Data Items)" object.
//

//--------------------------------------------------------------------
// Include Chart Framework class or ID defs/headers this file needs.
// Paths are relative to the IDE's (global) include path: ~/cfrz
//--------------------------------------------------------------------
#include    <cf_api/cf_defs.h>
            // Platform-Independent Chart Framework Typedefs...

class       cf_DyArr;   // We'll use dynamic arrays of (void) ptrs
#include    <cf_api/c0_dyarr.hpp>  // to XYZ data item objects

class       cf_String;
#include    <cf_api/c0_dystr.hpp>

class       cf_DispAttribs;
#include    <cf_api/c0_datb.hpp>

class       cf_TextAttribs;
#include    <cf_api/c0_tatb.hpp>

class       cf_XYZ;
#include    <cf_api/c1_xyz.hpp>

//
// Declare a Chart Framework "Data Group" class.
//
// Class cf_DataGroup hold cf_XYZ objects in an envelope/letter
// relationship -- this object it the envelope.
//
class CF_EXPORT   cf_DataGroup

{

public:

    cf_DataGroup(); // Std (and default) c-tor:

    cf_DataGroup( const char *a_cStringForLabel );

    ~cf_DataGroup();// Std (and non-virtual) d-tor:

    cf_DataGroup    operator=( const cf_DataGroup &cr_cf_dgSource );
                    //  Defines a '=' (assignment) Operator:

    BOOL        active();
    void        active( BOOL bNewState );
                // Users may want to turn sets of data groups on/off.

    cf_XYZ*     activateXYZValAt( int iPrefIndexIfAvail );
                // Users will want a pointer to current items.
                // This will yield a pointer to either the indicated
                // index, or -- if there is no item at the index,
                // this will return the xyz-item at either the 
                // largest current index, or if there are no current
                // values, a default xyz-item of (0,0,0,NULL).

    cf_XYZ*     addXYZVal(  double dXVal, 
                            double dYVal, 
                            double dZVal );

    cf_XYZ*     addXYZVal(  cf_XYZ  &r_cf_xyzUserVal );
                // Users will (no doubt) want to set values in the 
                // group.  They can also operate on the pointer 
                // return value to the newle created cf_XYZ object 
                // to do things like add an optional label, etc...


    double      dataXMax();
    double      dataXMin();
    double      dataYMax();
    double      dataYMin();
    double      dataZMax();
    double      dataZMin();
                // Users may want to get running group data ranges.
    
    double      dataXSum();
    double      dataYSum();
    double      dataYSumAbs();  // Sum all the Y-Vals' Absolute Values
    double      dataZSum();
                // Users may want to get running group data sums.
                // Note that "z-sums" are not of particular use.

    cf_DispAttribs*
                dispAttribs();
                // get a pointer to this group's display attributes.

    cf_TextAttribs*
                textAttribs();
                // get a pointer to this group's text attributes.

    BOOL        hasData();
                // Users will want to know if this group has any data items
    
    cf_String*  labelIs();
    void        labelNew( const char *a_cStringForLabel ); 
                // Get & set group label string attribute.

    int         numItems();
                // get the number of active/allocated items.
    
    void        on();
    void        off();
                // Set methods which are synonyms of this->active( BOOL ).

    void        reset();
                // Deletes any allocated XYZ points, and
                // resets counters, but keep attribs, etc
private:

    void                ctorInit();
                        // Multiple c-tors share this common functionality.

    BOOL                bIsActive;
                        // We may be "on", we may be "off"...
                        // The c-tor default state is "off" (FALSE).

    cf_String           cf_strGroupLabel;
                        // Attribute can be referenced by user objects.
                        // The c-tor default state is "".

    cf_DispAttribs      cf_datbGroupDispAttribs;
                        // Encapuslated set of Display Attributes.
                        // For spec on default c-tor init state,
                        // see the corresponding object header file

    cf_TextAttribs      cf_tatbGroupTextAttribs;
                        // Encapuslated set of Text Attributes.
                        // For spec on default c-tor init state,
                        // see the corresponding object header file

    double  dDataXMax, dDataXMin;
    double  dDataYMax, dDataYMin;
    double  dDataZMax, dDataZMin;
    double  dDataXSum, dDataYSum, dDataZSum;
            // Keep running tabs on the data items
            // The c-tor default state is 0.0 for each.

    cf_DyArr    da_p_cf_xyzDataItems;
    int         iNumAllocs;
                // This cf_DataGroup will coordinate the creation, 
                // destruction, and manipulation of a set of
                // cf_XYZ objects. Indexing by natural numbers, 1..n.
                // C-tor inits iNumAllocs vals to 0, and performs
                // an ++ op before each addData() op.  Dynamic Array 
                // "grow-by" val is #define'd in the cpp file as 
                // C1_DGROU_GROWBY.  We locate this "dynamic" member var 
                // as the LAST member var to facilitate serialization...

};  //
    // End of cf_DataGroup declaration.
    //

#endif      // Terminates include re-definition protection

////////////////////////////////////////
// END of File: C1_DGROU.HPP
////////////////////////////////////////  

            
