Skip to content

CCEXP Adding Data Methods

terablade2001 edited this page Dec 10, 2016 · 2 revisions

List of Methods:

Methods Description
AddVal Add 1 element at the current Column/Row position at a Table.
SetVal Add 1 element at the selected Column/Row position at a Table, if it already this position exist.
AddRow Add 1 row of arbitrary number of elements at a new Row for a Table.
ReplaceRow Replaces 1 row of arbitrary number of elements with a new Row for a Table.
AppendRow Append 1 row of arbitrary number of elements after the last column of a given row.
InitRowByScalar Initialize a row of a Table, with N elements with a specific number.
NewRow Denotes that the next data that will be added with AddVal will be placed in a new row.
NoNewRow Cancels the NewRow effect if it is used without '1' as third argument.

AddVal

	// getClockTime(): Return timestamp as 'uint32_t' number.
	// getSystemPositionX(): Return a 'float' number.	
	for (int i = 0; i < 100; i++) {	
		CCEXP::AddVal<uint32_t>(DBG, "Timestamp", getClockTime());
		CCEXP::AddVal<float>(DBG, "Position", getSystemPositionX());
	}

The result will be like:

Tables Rows Cols
Timestamp 1 100
Position 1 100

^ List of Methods ^

SetVal

Example:

	// Populate Tables with AddVal first
	for (int i = 0; i < 100; i++) {	
		CCEXP::AddVal<uint32_t>(DBG, "Timestamp", getClockTime());
		CCEXP::AddVal<float>(DBG, "Position", getSystemPositionX());
	}
	// Now use SetVal
	CCEXP::SetVal<uint32_t>(DBG, "Timestamp", 0, 9, 101);
	CCEXP::SetVal<float>(DBG, "Position", 0, 9, 33.3f);
	

In the result the 10th column (9 is 0-based index in C++) of the first row, for the Table Timestamp, will be 101, while for the same column and row for the Table Position will be 33.3 .

^ List of Methods ^

AddRow

Example:

	//getSystemPositionXYZ(outData) returns 3 float numbers in outData.
	float* outData[3];
	for (int i = 0; i < 100; i++) {	
		CCEXP::AddVal<uint32_t>(DBG, "Timestamp", getClockTime());
		getSystemPositionXYZ(outData);
		CCEXP::AddRow<float>(DBG, "Position", outData, 3);
	}

The result will be like:

Tables Rows Cols
Timestamp 1 100
Position 100 3

^ List of Methods ^

AppendRow

Example:

	//getSystemPositionXYZ(outData) returns 3 float numbers in outData.
	float* outData[3];
	for (int i = 0; i < 100; i++) {	
		CCEXP::AddVal<uint32_t>(DBG, "Timestamp", getClockTime());
		getSystemPositionXYZ(outData);
		CCEXP::AppendRow<float>(DBG, "Position", 0, outData, 3);
	}

The result will be like:

Tables Rows Cols
Timestamp 1 100
Position 1 300

^ List of Methods ^

ReplaceRow

Example:

	// Start like AddRow() example...
	//getSystemPositionXYZ(outData) returns 3 float numbers in outData.
	float* outData[3];
	for (int i = 0; i < 100; i++) {	
		CCEXP::AddVal<uint32_t>(DBG, "Timestamp", getClockTime());
		getSystemPositionXYZ(outData);
		CCEXP::AppendRow<float>(DBG, "Position", 0, outData, 3);
	}

	// Use ReplaceRow() here...
	uint32_t UpDTime = getClockTime();
	CCEXP::ReplaceRow<uint32_t>(DBG, "Timestamp", 0, &UpDTime, 1);
	getSystemPositionXYZ(outData);
	CCEXP::ReplaceRow<float>(DBG, "Position", 0, outData, 3);

The result will be like:

Tables Rows Cols
Timestamp 1 1
Position 1 3

^ List of Methods ^

InitRowByScalar

Example:

	float* outData[3];
	for (int i = 0; i < 100; i++) {	
		getSystemPositionXYZ(outData);
		CCEXP::AddRow<float>(DBG, "Position", outData, 3);
	}
	// Replace Row 0 with a new Row
	CCEXP::InitRowByScalar<float>(DBG, "Position", 0, 1.0f, 3);
	// Add a new Row at the end...
	CCEXP::InitRowByScalar<float>(DBG, "Position", -1, 2.0f, 3);

The result will be like:

Tables Rows Cols
Position 101 3

where:
Position-Row{0} = [1.0f 1.0f 1.0f];
Position-Row{100} = [2.0f 2.0f 2.0f];

^ List of Methods ^

NewRow

Note: Using '1' as third argument, creates a new empty Row at the table, while using '0' as third argument does not create new row until a new value is added to a table.
Example:

	CCEXP::AddVal<uint32_t>(DBG, "Timestamp", getClockTime());
	CCEXP::AddVal<uint32_t>(DBG, "Timestamp", getClockTime());
	CCEXP::AddVal<uint32_t>(DBG, "Timestamp", getClockTime());
	CCEXP::NewRow(DBG, "Timestamp", 1);
	CCEXP::AddVal<uint32_t>(DBG, "Timestamp", getClockTime());
	CCEXP::AddVal<uint32_t>(DBG, "Timestamp", getClockTime());
	CCEXP::NewRow(DBG, "Timestamp", 1);
	CCEXP::AddVal<uint32_t>(DBG, "Timestamp", getClockTime());
	CCEXP::NewRow(DBG, "Timestamp", 1);
	CCEXP::NewRow(DBG, "Timestamp", 1);
	CCEXP::NewRow(DBG, "Timestamp", 1);
	CCEXP::AddVal<uint32_t>(DBG, "Timestamp", getClockTime());
	CCEXP::AddVal<uint32_t>(DBG, "Timestamp", getClockTime());
	CCEXP::NewRow(DBG, "Timestamp", 0);
	CCEXP::NewRow(DBG, "Timestamp", 0);
	CCEXP::NewRow(DBG, "Timestamp", 0);
	CCEXP::AddVal<uint32_t>(DBG, "Timestamp", getClockTime());
	CCEXP::AddVal<uint32_t>(DBG, "Timestamp", getClockTime());

The result will be like:

Timestamp-Row{0}: 3 Cols
Timestamp-Row{1}: 2 Cols
Timestamp-Row{2}: 1 Cols
Timestamp-Row{3}: 0 Cols
Timestamp-Row{4}: 0 Cols
Timestamp-Row{5}: 2 Cols
Timestamp-Row{6}: 2 Cols

^ List of Methods ^

NoNewRow

Example:

	CCEXP::AddVal<uint32_t>(DBG, "Timestamp", getClockTime());
	CCEXP::AddVal<uint32_t>(DBG, "Timestamp", getClockTime());
	CCEXP::AddVal<uint32_t>(DBG, "Timestamp", getClockTime());
	CCEXP::NewRow(DBG, "Timestamp", 1);
	CCEXP::NoNewRow(DBG, "Timestamp");
	CCEXP::AddVal<uint32_t>(DBG, "Timestamp", getClockTime());
	CCEXP::AddVal<uint32_t>(DBG, "Timestamp", getClockTime());
	CCEXP::NewRow(DBG, "Timestamp", 0);
	CCEXP::NoNewRow(DBG, "Timestamp");
	CCEXP::AddVal<uint32_t>(DBG, "Timestamp", getClockTime());

The result will be like:

Timestamp-Row{0}: 3 Cols
Timestamp-Row{1}: 3 Cols

^ List of Methods ^

Clone this wiki locally