|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Params.h: interface for the CParams class.
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//////////////////////////////////////////////////////////////////////
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#if !defined(AFX_PARAMS_H__40D9A921_F329_11D5_B92E_0040F674BE6A__INCLUDED_)
|
|
Toshihiro Shimizu |
890ddd |
#define AFX_PARAMS_H__40D9A921_F329_11D5_B92E_0040F674BE6A__INCLUDED_
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
9f5a1b |
#ifdef _WIN32
|
|
|
e280ae |
#include "windows.h"
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
#include <fstream></fstream>
|
|
Toshihiro Shimizu |
890ddd |
#include <vector></vector>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "InputParam.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#define P(d) tmsg_info(" - %d -\n", d)
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
template <class eparam=""></class>
|
|
Shinya Kitaoka |
120a6e |
class CParams {
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
std::vector<eparam> m_params;</eparam>
|
|
Shinya Kitaoka |
120a6e |
double m_scale;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
CParams() : m_params(0), m_scale(1.0){};
|
|
Shinya Kitaoka |
120a6e |
CParams(const CParams &cp) : m_params(cp.m_params), m_scale(cp.m_scale){};
|
|
Shinya Kitaoka |
120a6e |
virtual ~CParams(){};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
CParams(const CInputParam &ip) : m_scale(ip.m_scale) {
|
|
Shinya Kitaoka |
120a6e |
if (ip.m_isEconf) {
|
|
Shinya Kitaoka |
120a6e |
// read(ip.m_econfFN);
|
|
Shinya Kitaoka |
120a6e |
} else {
|
|
Shinya Kitaoka |
120a6e |
m_params.resize(1);
|
|
Shinya Kitaoka |
120a6e |
m_params[0].read(ip);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
/*
|
|
Shinya Kitaoka |
120a6e |
void print()
|
|
Toshihiro Shimizu |
890ddd |
{ char s[1024];
|
|
Shinya Kitaoka |
120a6e |
int i;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
OutputDebugString("===== PARAMS =====\n");
|
|
Rozhuk Ivan |
823a31 |
snprintf(s, sizeof(s), "Scale=%f\n",m_scale);
|
|
Shinya Kitaoka |
120a6e |
OutputDebugString(s);
|
|
Shinya Kitaoka |
120a6e |
i=0;
|
|
Shinya Kitaoka |
120a6e |
for( vector<eparam>::iterator p=m_params.begin();</eparam>
|
|
Shinya Kitaoka |
120a6e |
p!=m_params.end(); ++p,++i ){
|
|
Rozhuk Ivan |
823a31 |
snprintf(s, sizeof(s), "--- %d. Param ---\n",i);
|
|
Shinya Kitaoka |
120a6e |
OutputDebugString(s);
|
|
Shinya Kitaoka |
120a6e |
p->print();
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
OutputDebugString("==================\n");
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Shinya Kitaoka |
120a6e |
/*
|
|
Toshihiro Shimizu |
890ddd |
void read(const basic_string<char>& name)</char>
|
|
Toshihiro Shimizu |
890ddd |
{ basic_ifstream<char> in(name.c_str());</char>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
for( bool isOK=true; isOK; ) {
|
|
Shinya Kitaoka |
120a6e |
m_params.resize(m_params.size()+1);
|
|
Shinya Kitaoka |
120a6e |
vector<eparam>::iterator p=m_params.end();</eparam>
|
|
Shinya Kitaoka |
120a6e |
p--;
|
|
Shinya Kitaoka |
120a6e |
isOK=p->read(in);
|
|
Shinya Kitaoka |
120a6e |
if ( !isOK )
|
|
Shinya Kitaoka |
120a6e |
m_params.resize(m_params.size()-1);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
in.close();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void scale(const double sc) {
|
|
Shinya Kitaoka |
120a6e |
for (int i = 0; i < m_params.size(); ++i) m_params[i]->scale(sc);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void scale() {
|
|
Shinya Kitaoka |
120a6e |
for (int i = 0; i < m_params.size(); ++i) m_params[i]->scale(m_scale);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
#endif // !defined(AFX_PARAMS_H__40D9A921_F329_11D5_B92E_0040F674BE6A__INCLUDED_)
|