agentppTestSharedEntry::agentppTestSharedEntry():
   MibTable(oidAgentppTestSharedEntry, indAgentppTestSharedEntry, 1)
{
	// This table object is a singleton. In order to access it use
	// the static pointer agentppTestSharedEntry::instance.
	instance = this;

	add_col(new agentppTestSharedTableCreationTime(colAgentppTestSharedTableCreationTime));
	add_col(new agentppTestSharedTableDelay(colAgentppTestSharedTableDelay));
	add_col(new agentppTestSharedTableSession(colAgentppTestSharedTableSession));
	add_col(new agentppTestSharedTableRowStatus(colAgentppTestSharedTableRowStatus));
	//--AgentGen BEGIN=agentppTestSharedEntry::agentppTestSharedEntry
	//--AgentGen END
}
agentppTestSparseEntry::agentppTestSparseEntry():
   MibTable(oidAgentppTestSparseEntry, indAgentppTestSparseEntry, 1)
{
	// This table object is a singleton. In order to access it use
	// the static pointer agentppTestSparseEntry::instance.
	instance = this;

	add_col(new agentppTestSparseCol1(colAgentppTestSparseCol1));
	add_col(new agentppTestSparseCol2(colAgentppTestSparseCol2));
	add_col(new agentppTestSparseCol3(colAgentppTestSparseCol3));
	add_col(new agentppTestSparseRowStatus(colAgentppTestSparseRowStatus));
	//--AgentGen BEGIN=agentppTestSparseEntry::agentppTestSparseEntry
	//--AgentGen END
}
Exemple #3
0
void Motif::read(istream& motin) {
	char line[200];
	vector<int> c;
	vector<int> p;
	vector<bool> s;
	
	// Read sites
	// (don't add yet, as they will get screwed up by the column changes)
	while(motin.getline(line, 200)) {
		if(line[0] == '*') break;
		strtok(line, "\t");
		c.push_back(atoi(strtok(NULL, "\t")));
		p.push_back(atoi(strtok(NULL, "\t")));
		s.push_back(atoi(strtok(NULL, "\0")));
	}
	
	int motwidth = strlen(line);
	columns.clear();
	for(int i = 0; i < motwidth; i++) {
		if(line[i] == '*') add_col(i);
	}
	
	// Add sites
	sitelist.clear();
	int num_sites = c.size();
	for(int i = 0; i < num_sites; i++) {
		assert(p[i] >= 0);
		add_site(c[i], p[i], s[i]);
	}
	
	// Read MAP score
	motin.getline(line, 200);
	strtok(line, ":");
	set_map(atof(strtok(NULL, "\0")));
	
	// Read specificity
	motin.getline(line, 200);
	strtok(line, ":");
	set_spec(atof(strtok(NULL, "\0")));
	
	// Read sequence cutoff
	motin.getline(line, 200);
	strtok(line, ":");
	set_seq_cutoff(atof(strtok(NULL, "\0")));
	
	// Read expression cutoff
	motin.getline(line, 200);
	strtok(line, ":");
	set_expr_cutoff(atof(strtok(NULL, "\0")));
	
	// Read iteration found
	motin.getline(line, 200);
	strtok(line, ":");
	set_iter(strtok(NULL, "\0"));
	
	// Read dejavu
	motin.getline(line, 200);
	strtok(line, ":");
	set_dejavu(atoi(strtok(NULL, "\0")));
}
agentppTestSessionsEntry::agentppTestSessionsEntry():
   MibTable(oidAgentppTestSessionsEntry, indAgentppTestSessionsEntry, 1)
{
	// This table object is a singleton. In order to access it use
	// the static pointer agentppTestSessionsEntry::instance.
	instance = this;

	add_col(new agentppTestRowCreation(colAgentppTestRowCreation));
	//--AgentGen BEGIN=agentppTestSessionsEntry::agentppTestSessionsEntry
	//--AgentGen END
}
/** execute_db_operator takes as input the db_operator and executes the query.
 * It should return the result (currently as a char*, although I'm not clear
 * on what the return type should be, maybe a result struct, and then have
 * a serialization into a string message).
 **/
char* execute_db_operator(db_operator* query) {
    status s;

    if (query->type == INSERT) {
        table* tbl1 = query->tables[0];
        for(size_t i = 0; i < tbl1->col_count; i++) {
            s = col_insert(query->columns[i], query->value1[i]);
            if (s.code != OK) {
                return s.error_message;
            }
        }
        return "Rows successfully inserted.";
    } else if (query->type == SELECT) {
        result* r = malloc(sizeof(struct result));
        if (query->columns) {
            s = select_data(query, &r);
        } else if (query->result1 && query->result2) {
            s = vec_scan(query, &r);
        } else {
            return "Cannot perform select\n";
        }

        if (s.code != OK) {
            return s.error_message;
        }
        int idx = catalogs[0]->var_count;
        catalogs[0]->names[idx] = query->name1;
        catalogs[0]->results[idx] = r;
        catalogs[0]->var_count++;
    } else if (query->type == PROJECT) {
        result* r = malloc(sizeof(struct result));
        status s = fetch(*(query->columns), query->result1->payload, query->result1->num_tuples, &r);
        if (s.code != OK) {
            return s.error_message;
        }
        int idx = catalogs[0]->var_count;
        catalogs[0]->names[idx] = query->name1;
        catalogs[0]->results[idx] = r;
        catalogs[0]->var_count++;
    } else if (query->type == ADD) {
        result* r = malloc(sizeof(struct result));
        s = add_col((int*)query->result1->payload, (int*)query->result2->payload, query->result1->num_tuples, &r);
        if (s.code != OK) {
            return s.error_message;
        }
        int idx = catalogs[0]->var_count;
        catalogs[0]->names[idx] = query->name1;
        catalogs[0]->results[idx] = r;
        // for (size_t i = 0; i < r->num_tuples; ++i)
        // {
        //     printf("%ld\n", ((long*)r->payload)[i]);
        // }
        catalogs[0]->var_count++;
    } else if (query->type == SUB) {
        result* r = malloc(sizeof(struct result));
        s = sub_col((int*)query->result1->payload, (int*)query->result2->payload, query->result1->num_tuples, &r);
        if (s.code != OK) {
            return s.error_message;
        }
        int idx = catalogs[0]->var_count;
        catalogs[0]->names[idx] = query->name1;
        catalogs[0]->results[idx] = r;
        catalogs[0]->var_count++;
    } else if (query->type == AGGREGATE) {
        result* r = malloc(sizeof(struct result));
        if (query->agg == MIN) {
            s = min_col(query->result1, &r);
        } else if (query->agg == MAX) {
            s = max_col(query->result1, &r);
        } else if (query->agg == AVG) {
            s = avg_col(query->result1, &r);
        } else if (query->agg == CNT) {
            s = count_col(query->result1->num_tuples, &r);
        } else {
            return "Failed aggregation";
        }

        if (s.code != OK) {
            return s.error_message;
        }

        int idx = catalogs[0]->var_count;
        catalogs[0]->names[idx] = query->name1;
        catalogs[0]->results[idx] = r;
        catalogs[0]->var_count++;
    }

    return "Success";
}
Exemple #6
0
void	listExt::create_cols(CString* col_headings,int n_col)
{
	for (int i=0; i<n_col; i++)
		add_col(i,col_headings[i]);
}
Exemple #7
0
void	listExt::add_col(CString heading)
{
	add_col(total_col,heading);
}