class c4_View

A collection of data rows.

Public members
c4_View (c4_Sequence* implementation_ =0);
Construct a view based on a sequence
c4_View (c4_CustomViewer* viewer_);
Construct a view based on a custom viewer
c4_View (const c4_View& view_);
Construct an empty view with one propertyConstruct a view from another one
c4_View (const c4_View& view_);
Construct an empty view with one propertyConstruct a view from another one
~c4_View ();
Destructor, decrements reference count
c4_View& operator= (const c4_View& source_);
Make this view the same as another one
int GetSize () const;
Return the number of entries
int GetUpperBound () const;
Return highest index (size - 1)
void SetSize (int newSize_, int growBy_ =-1);
Change the size of this view
void RemoveAll ();
Remove all entries (sets size to zero)
c4_RowRef GetAt (int index_) const;
Return a reference to specified entry
c4_RowRef operator[] (int index_) const;
Shorthand for c4_View::GetAt
void SetAt (int index_, const c4_RowRef& row_);
Change the value of the specified entry
c4_RowRef ElementAt (int index_);
Element access, for use as RHS or LHS
bool GetItem (int row_, int col_, c4_Bytes& buf_) const;
Get a single data item in a generic way
void SetAtGrow (int index_, const c4_RowRef& row_);
Set an entry, growing the view if needed
int Add (const c4_RowRef& row_);
Add a new entry, same as "SetAtGrow(GetSize(), ...)".
void InsertAt (int index_, const c4_RowRef& row_, int count_ =1);
Insert one or more copies of an entry
void RemoveAt (int index_, int count_ =1);
Remove entries starting at the given index
void InsertAt (int index_, const c4_View& view_);
Insert a copy of the contents of another view
bool RelocateRows (int from_, int count_, c4_View& dest_, int pos_);
Move attached rows to somewhere else in same storage
int NumProperties () const;
Return the number of properties
const c4_Property& NthProperty (int column_) const;
Return the id of the N-th property
int FindProperty (int id_);
Find the index of a property, given its id
int FindPropIndexByName (const char* name_) const;
Find the index of a property, given its name
c4_View Structure () const;
Return a view which describes the structure of this view
const char* Describe () const;
Return a description of the structure
static const char* Description (const c4_View& view_);
Return a homogenized description of this view
c4_View Duplicate (bool deepCopy_ =false) const;
Construct a new view with a copy of the data
c4_View Clone () const;
Construct a new view with the same structure but no data
int AddProperty (const c4_Property& property_);
Adds a property column to a view if not already present
c4_View operator, (const c4_Property& property_) const;
Return a view like the first, with a property appended to it
c4_View Sort () const;
Create view with all rows in natural (property-wise) order
c4_View SortOn (const c4_View& order_) const;
Create view sorted according to the specified properties
c4_View SortOnReverse (const c4_View& order_, const c4_View& orderDown_) const;
Create sorted view, with some properties sorted in reverse
c4_View Select (const c4_RowRef& criterium_) const;
Create view with rows matching the specified value
c4_View SelectRange (const c4_RowRef& rowLow_, const c4_RowRef& rowHigh_) const;
Create view with row values within the specified range
c4_View Project (const c4_View& order_) const;
Create view with the specified property arrangement
c4_View ProjectWithout (const c4_View& order_) const;
Create derived view with some properties omitted
c4_View Slice (int start_, int limit_ =-1, int step_ =1) const;
Create view which is a segment/slice (default is up to end)
c4_View Product (const c4_View& view_) const;
Create view which is the cartesian product with given view
c4_View RemapWith (const c4_View& order_) const;
Create view which remaps another given view
c4_View Pair (const c4_View& view_) const;
Create view which pairs each row with corresponding row
c4_View Concat (const c4_View& view_) const;
Create view with rows from another view appended
c4_View Rename (const c4_Property& old_, const c4_Property& new_) const;
Create view with one property renamed (must be of same type)
c4_View GroupBy (const c4_View& keys_, const c4_ViewProp& name_) const;
Create view with a subview, grouped by the specified properties
c4_View Counts (const c4_View& keys_, const c4_IntProp& name_) const;
Create view with count of duplicates, when grouped by key
c4_View Unique () const;
Create view with all duplicate rows omitted
c4_View Union (const c4_View& view_) const;
Create view which is the set union (assumes no duplicate rows)
c4_View Intersect (const c4_View& view_) const;
Create view with all rows also in the given view (no dups)
c4_View Different (const c4_View& view_) const;
Create view with all rows not in both views (no dups)
c4_View Minus (const c4_View& view_) const;
Create view with all rows not in the given view (no dups)
c4_View JoinProp (const c4_ViewProp& sub_, bool outer_ =false) const;
Create view with a specific subview expanded, like a join
c4_View Join (const c4_View& keys_, const c4_View& view_, bool outer_ =false) const;
Create view which is the relational join on the given keys
int GetIndexOf (const c4_RowRef& row_) const;
Return the index of the specified row in this view (or -1)
int Find (const c4_RowRef& key_, int start_ =0) const;
Find index of the the next entry matching the specified key
int Search (const c4_RowRef& key_) const;
Search for a key, using the native sort order of the view
int Compare (const c4_View& view_) const;
Protected members
void _IncSeqRef ();
void _DecSeqRef ();
Friends
friend bool operator== (const c4_View& a_, const c4_View& b_);
Return true if the contents of both views are equal
friend bool operator!= (const c4_View& a_, const c4_View& b_);
Return true if the contents of both views are not equal
friend bool operator< (const c4_View& a_, const c4_View& b_);
True if first view is less than second view
friend bool operator> (const c4_View& a_, const c4_View& b_);
True if first view is greater than second view
friend bool operator<= (const c4_View& a_, const c4_View& b_);
True if first view is less or equal to second view
friend bool operator>= (const c4_View& a_, const c4_View& b_);
True if first view is greater or equal to second view
friend class c4_ViewRef;


Header file "mk4.h"   --   Dec 9, 1999