本文整理汇总了C++中read_double函数的典型用法代码示例。如果您正苦于以下问题:C++ read_double函数的具体用法?C++ read_double怎么用?C++ read_double使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了read_double函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: return
PackageCanvas * PackageCanvas::read(char * & st, UmlCanvas * canvas, char * k) {
if (!strcmp(k, "packagecanvas_ref"))
return ((PackageCanvas *) dict_get(read_id(st), "packagecanvas", canvas));
else if (!strcmp(k, "packagecanvas")) {
int id = read_id(st);
BrowserNode * br = BrowserPackage::read_ref(st);
UmlColor color = UmlDefaultColor;
Uml3States in_tab = UmlDefaultState;
ShowContextMode context = DefaultShowContextMode;
Uml3States show_stereotype_properties = UmlDefaultState;;
k = read_keyword(st);
if (!strcmp(k, "name_in_tab")) {
in_tab = state(read_keyword(st));
k = read_keyword(st);
}
if (!strcmp(k, "show_context_mode")) {
context = context_mode(read_keyword(st));
k = read_keyword(st);
}
if (!strcmp(k, "show_stereotype_properties")) {
show_stereotype_properties = state(read_keyword(st));
k = read_keyword(st);
}
read_color(st, "color", color, k);
if (strcmp(k, "xyzwh"))
wrong_keyword(k, "xyzwh");
int x = (int) read_double(st);
PackageCanvas * result =
new PackageCanvas(br, canvas, x, (int) read_double(st), id);
read_zwh(st, result);
if (read_file_format() >= 58) {
k = read_keyword(st);
result->read_stereotype_property(st, k); // updates k
if (strcmp(k, "end"))
wrong_keyword(k, "end");
}
result->name_in_tab = in_tab;
result->show_context_mode = context;
result->show_stereotype_properties = show_stereotype_properties;
result->itscolor = color;
result->check_size();
result->set_center100();
result->show();
result->check_stereotypeproperties();
return result;
}
else
return 0;
}
示例2: readParameters
int readParameters(int *xlength, double *tau, double *velocityWall, int *timesteps, int *timestepsPerPlotting, int argc, char *argv[]){
// argument handling
if (argc !=2 ) {
printf("When running the simulation, please give a valid file name to read from!\n");
return 1;
}
// get file name
const char *FileName = NULL;
FileName = argv[1];
// read parameters, using read functions from helper
read_int ( FileName, "xlength", xlength );
read_double ( FileName, "tau", tau );
read_double ( FileName, "velocityWallx", &velocityWall[0] );
read_double ( FileName, "velocityWally", &velocityWall[1] );
read_double ( FileName, "velocityWallz", &velocityWall[2] );
read_int ( FileName, "timesteps", timesteps );
read_int ( FileName, "timestepsPerPlotting", timestepsPerPlotting );
return 0;
}
示例3: gs_image_size_sub
bool
gs_image_size_sub (string buf, int& w_pt, int& h_pt) {
int pos= search_forwards ("\n%%BoundingBox: ", buf);
if (pos < 0) pos = search_forwards ("%%BoundingBox: ", buf);
if (pos < 0) return false;
if (buf[pos] == '\n') pos++;
bool ok= read (buf, pos, "%%BoundingBox: ");
double X1, Y1, X2, Y2;
int x1, y1, x2, y2;
skip_spaces (buf, pos);
ok= read_double (buf, pos, X1) && ok;
x1= (int) floor (X1);
skip_spaces (buf, pos);
ok= read_double (buf, pos, Y1) && ok;
y1= (int) floor (Y1);
skip_spaces (buf, pos);
ok= read_double (buf, pos, X2) && ok;
x2= (int) ceil (X2);
skip_spaces (buf, pos);
ok= read_double (buf, pos, Y2) && ok;
y2= (int) ceil (Y2);
if (!ok) return false;
w_pt= x2-x1;
h_pt= y2-y1;
return true;
}
示例4: return
AssocContainCanvas * AssocContainCanvas::read(char * & st, UmlCanvas * canvas, char * k)
{
if (!strcmp(k, "containcanvas_ref"))
return ((AssocContainCanvas *) dict_get(read_id(st), "contain canvas", canvas));
else if (!strcmp(k, "containcanvas")) {
int id = read_id(st);
LineGeometry geo;
bool fixed;
k = read_keyword(st); // may read id
if (!strcmp(k, "geometry")) {
geo = line_geometry(read_keyword(st));
k = read_keyword(st);
if (! strcmp(k, "unfixed")) {
k = read_keyword(st);
fixed = FALSE;
}
else
fixed = TRUE;
}
else {
geo = NoGeometry;
fixed = FALSE;
}
float dbegin;
float dend;
if (! strcmp(k, "decenter_begin")) {
dbegin = read_double(st) / 1000;
k = read_keyword(st);
}
else
dbegin = -1;
if (! strcmp(k, "decenter_end")) {
dend = read_double(st) / 1000;
k = read_keyword(st);
}
else
dend = -1;
unread_keyword(k, st);
AssocContainCanvas * r = (AssocContainCanvas *)
read_list(st, canvas, UmlContain, geo, fixed, dbegin, dend, id, &make);
// remove association between components available in the
// 2.0 deployment diagrams
if (r->begin->type() == UmlComponent)
Undefined.append(r);
else if (read_file_format() == 30)
// to remove redondant transitions made by release 2.22
RelsToCheck.append(r);
return r;
}
else
return 0;
}
示例5: collect_memory
static void
collect_memory (CockpitSamples *samples,
const gchar *path,
const gchar *cgroup)
{
double mem_usage_in_bytes;
double mem_limit_in_bytes;
double memsw_usage_in_bytes;
double memsw_limit_in_bytes;
if (access (path, F_OK) == 0)
{
mem_usage_in_bytes = read_double (path, "memory.usage_in_bytes");
mem_limit_in_bytes = read_double (path, "memory.limit_in_bytes");
memsw_usage_in_bytes = read_double (path, "memory.memsw.usage_in_bytes");
memsw_limit_in_bytes = read_double (path, "memory.memsw.limit_in_bytes");
/* If at max for arch, then unlimited => zero */
if (mem_limit_in_bytes == (double)G_MAXSIZE ||
mem_limit_in_bytes == (double)G_MAXSSIZE)
mem_limit_in_bytes = 0;
if (memsw_limit_in_bytes == (double)G_MAXSIZE ||
memsw_limit_in_bytes == (double)G_MAXSSIZE)
memsw_limit_in_bytes = 0;
cockpit_samples_sample (samples, "cgroup.memory.usage", cgroup, mem_usage_in_bytes);
cockpit_samples_sample (samples, "cgroup.memory.limit", cgroup, mem_limit_in_bytes);
cockpit_samples_sample (samples, "cgroup.memory.sw-usage", cgroup, memsw_usage_in_bytes);
cockpit_samples_sample (samples, "cgroup.memory.sw-limit", cgroup, memsw_limit_in_bytes);
}
}
示例6: readParameters
/**
* Reads the parameters for the lid driven cavity scenario from a config file.
* Throws an error if number of program arguments does not equal 2.
**/
int readParameters(
int *xlength, /* reads domain size. Parameter name: "xlength" */
double *tau, /* relaxation parameter tau. Parameter name: "tau" */
double *velocityWall, /* velocity of the lid. Parameter name: "characteristicvelocity" */
int *timesteps, /* number of timesteps. Parameter name: "timesteps" */
int *timestepsPerPlotting, /* timesteps between subsequent VTK plots. Parameter name: "vtkoutput" */
int argc, /* number of arguments. Should equal 2 (program + name of config file */
char *argv[] /* argv[1] shall contain the path to the config file */
){
const char *szFileName = argv[1];
if (argc != 2) {
ERROR("number of arguments is incorrect");
}
read_int(szFileName, "xlength", xlength);
read_double(szFileName,"tau", tau);
read_double(szFileName, "characteristicvelocity_x", &velocityWall[0]);
read_double(szFileName, "characteristicvelocity_y", &velocityWall[1]);
read_double(szFileName, "characteristicvelocity_z", &velocityWall[2]);
read_int(szFileName, "timesteps", timesteps);
read_int(szFileName, "vtkoutput", timestepsPerPlotting);
return 0;
}
示例7: read_uint8
void
Squeezer_file_header_t::read_from_file(FILE * in)
{
file_type_mark[0] = read_uint8(in);
file_type_mark[1] = read_uint8(in);
file_type_mark[2] = read_uint8(in);
file_type_mark[3] = read_uint8(in);
floating_point_check = read_double(in);
date_year = read_uint16(in);
date_month = read_uint8(in);
date_day = read_uint8(in);
time_hour = read_uint8(in);
time_minute = read_uint8(in);
time_second = read_uint8(in);
radiometer.horn = read_uint8(in);
radiometer.arm = read_uint8(in);
od = read_uint16(in);
first_obt = read_double(in);
last_obt = read_double(in);
first_scet_in_ms = read_double(in);
last_scet_in_ms = read_double(in);
number_of_chunks = read_uint32(in);
}
示例8: sum
template<> std::unique_ptr<Result>
DataServer::command(ReadSalesStatsUserCmd* cmd)
{
if( cmd->user > 0 ) {
sql << "select emp, sum(amt), count(amt) as sale_count from sales where amt > 0 and emp = " << cmd->user;
}
else {
sql << "select distinct on (emp) emp, sum(amt), count(amt) as sale_count from sales where amt > 0;";
}
run_sql();
std::unique_ptr<Result> result(new Result);
for( int i = 0; i < tuple_count(); i++ ) {
Item* sale_stat = new Item;
sale_stat->push_property("user", read_int(i, "emp"));
sale_stat->push_property("total", read_double(i, "sum"));
sale_stat->push_property("sale_count", read_double(i, "sale_count"));
result->items.push_back( std::unique_ptr<Item>(sale_stat) );
}
clr_sql();
return result;
}
示例9: return
DeploymentNodeCanvas * DeploymentNodeCanvas::read(char * & st, UmlCanvas * canvas, char * k) {
if (!strcmp(k, "deploymentnodecanvas_ref"))
return ((DeploymentNodeCanvas *) dict_get(read_id(st), "deploymentnodecanvas", canvas));
else if (!strcmp(k, "deploymentnodecanvas")) {
int id = read_id(st);
BrowserNode * br = BrowserDeploymentNode::read_ref(st);
QString iname;
Uml3States write_horizontally = UmlDefaultState;
Uml3States show_stereotype_properties = UmlDefaultState;
k = read_keyword(st);
if (!strcmp(k, "name")) {
iname = read_string(st);
k = read_keyword(st);
}
if (!strcmp(k, "write_horizontally") ||
!strcmp(k, "write_horizontaly")) {
write_horizontally = state(read_keyword(st));
k = read_keyword(st);
}
if (!strcmp(k, "show_stereotype_properties")) {
show_stereotype_properties = state(read_keyword(st));
k = read_keyword(st);
}
UmlColor color = UmlDefaultColor;
read_color(st, "color", color, k);
if (strcmp(k, "xyzwh"))
wrong_keyword(k, "xyzwh");
int x = (int) read_double(st);
DeploymentNodeCanvas * result =
new DeploymentNodeCanvas(br, canvas, x, (int) read_double(st), id);
read_zwh(st, result);
if (read_file_format() >= 58) {
k = read_keyword(st);
result->read_stereotype_property(st, k); // updates k
if (strcmp(k, "end"))
wrong_keyword(k, "end");
}
result->iname = iname;
result->write_horizontally = write_horizontally;
result->show_stereotype_properties = show_stereotype_properties;
result->itscolor = color;
result->check_size();
result->set_center100();
result->show();
result->check_stereotypeproperties();
return result;
}
else
return 0;
}
示例10: read_double
void
Error_t::read_from_file(FILE * in)
{
min_abs_error = read_double(in);
max_abs_error = read_double(in);
mean_abs_error = read_double(in);
mean_error = read_double(in);
}
示例11: read_point
void read_point(boost::ptr_vector<geometry_type> & paths)
{
geometry_type* pt = new geometry_type(Point);
double x = read_double();
double y = read_double();
pt->move_to(x, y);
paths.push_back(pt);
}
示例12: read_point
mapnik::geometry::point<double> read_point()
{
double x = read_double();
double y = read_double();
if (Z) pos_ += 8;
if (M) pos_ += 8;
return mapnik::geometry::point<double>(x, y);
}
示例13: read_point
geometry_ptr read_point()
{
geometry_ptr pt(new point<vertex2d>(srid_));
double x = read_double();
double y = read_double();
pt->move_to(x,y);
return pt;
}
示例14: read_point
void read_point(boost::ptr_vector<geometry_type> & paths)
{
double x = read_double();
double y = read_double();
std::unique_ptr<geometry_type> pt(new geometry_type(geometry_type::types::Point));
pt->move_to(x, y);
paths.push_back(pt.release());
}
示例15: read_variable_count_record
static readstat_error_t read_variable_count_record(readstat_por_ctx_t *ctx) {
double value;
if (read_double(ctx, &value) == -1) {
return READSTAT_ERROR_PARSE;
}
ctx->var_count = (int)value;
ctx->varinfo = calloc(ctx->var_count, sizeof(spss_varinfo_t));
if (read_double(ctx, NULL) == -1) {
return READSTAT_ERROR_PARSE;
}
return READSTAT_OK;
}