Commit 8e816ae9 authored by denis's avatar denis

added method setQuoteTupel() to modify data within an existing quote object

parent 5517d68e
......@@ -47,6 +47,7 @@ static long int class_quotes_findDaynrIndexImpl(const class_quotes *self, unsign
static unsigned int class_quotes_findDaynrIndex_lBImpl(const class_quotes *self, unsigned int the_daynr);
static void class_quotes_appendQuoteRecordsImpl(class_quotes *self, unsigned int nr_additional_records);
static void class_quotes_appendQuoteTupelImpl(class_quotes *self, bstring *new_date, unsigned int new_daynr, float new_quote);
static void class_quotes_setQuoteTupelImpl(class_quotes *self, unsigned int idx, bstring *new_date, unsigned int new_daynr, float new_quote);
///////////////////////////////////////////////////////////////////////////////
/**
......@@ -108,6 +109,7 @@ static void class_quotes_setMethods(class_quotes* self)
self->findDaynrIndexlB = class_quotes_findDaynrIndex_lBImpl;
self->appendQuoteRecords = class_quotes_appendQuoteRecordsImpl;
self->appendQuoteTupel = class_quotes_appendQuoteTupelImpl;
self->setQuoteTupel = class_quotes_setQuoteTupelImpl;
}
///////////////////////////////////////////////////////////////////////////////
......@@ -380,4 +382,24 @@ static void class_quotes_appendQuoteTupelImpl(class_quotes *self, bstring *new_d
self->daynrvec[last_idx] = new_daynr;
self->quotevec[last_idx] = new_quote;
}
///////////////////////////////////////////////////////////////////////////////
/**
* @brief fill an (existing) single {date, daynr, quote} tupel of object
*
* This method fill an (existing) single {date, daynr, quote} tupel of object
*
* @param self pointer to quote object
* @param idx uint with index to be filled
* @param new_date bstring ptr with date (as XXXX-YY-ZZ)
* @param new_daynr uint with nr of days since 1900-01-01
* @param new_quote float with new quote
*/
///////////////////////////////////////////////////////////////////////////////
static void class_quotes_setQuoteTupelImpl(class_quotes *self, unsigned int idx, bstring *new_date, unsigned int new_daynr, float new_quote)
{
self->datevec[idx] = bstrcpy(*new_date);
self->daynrvec[idx] = new_daynr;
self->quotevec[idx] = new_quote;
}
// EOF
......@@ -45,6 +45,7 @@ typedef long int (*findDaynrIndexFunc)(const struct _class_quotes*, unsigned int
typedef unsigned int (*findDaynrIndex_lBFunc)(const struct _class_quotes*, unsigned int);
typedef void (*appendQuoteRecordsFunc)(struct _class_quotes*, unsigned int);
typedef void (*appendQuoteTupelFunc)(struct _class_quotes*, bstring*, unsigned int, float);
typedef void (*setQuoteTupelFunc)(struct _class_quotes*, unsigned int, bstring*, unsigned int, float);
struct _class_quotes
{
......@@ -69,6 +70,7 @@ struct _class_quotes
findDaynrIndex_lBFunc findDaynrIndexlB; /**< return lower boundary index of specific daynr: index or next smaller index if daynr not in array */
appendQuoteRecordsFunc appendQuoteRecords; /**< append an (empty) nr. of quote records to existing object */
appendQuoteTupelFunc appendQuoteTupel; /**< append a (single) {date, daynr, quote} tupel to existing object */
setQuoteTupelFunc setQuoteTupel; /**< fill an (existing) single {date, daynr, quote} tupel of object */
};
typedef struct _class_quotes class_quotes;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment