void CDlgComboLegs::CopyTwsComboLeg2ComboLeg(
	ComboLeg& comboLeg, /* const */ IComboLeg* comComboLeg,
	OrderComboLeg& orderComboLeg, /* const */ IOrderComboLeg* comOrderComboLeg)
{
	ASSERT (comComboLeg);
	ASSERT (comOrderComboLeg);

	typedef CComPropAccessor<IComboLeg> PropsComboLeg;
	typedef CComPropAccessor<IOrderComboLeg> PropsOrderComboLeg;

#define GET_PROP(PropComboLeg) \
	PropsComboLeg::Get(comboLeg.PropComboLeg, comComboLeg, &IComboLeg::get_##PropComboLeg);

	GET_PROP(conId);
	GET_PROP(ratio);
	GET_PROP(action);
	GET_PROP(exchange);
	GET_PROP(openClose);
	GET_PROP(shortSaleSlot);
	GET_PROP(designatedLocation);
	GET_PROP(exemptCode);

#undef GET_PROP

#define GET_PROP(PropOrderComboLeg) \
	PropsOrderComboLeg::Get(orderComboLeg.PropOrderComboLeg, comOrderComboLeg, &IOrderComboLeg::get_##PropOrderComboLeg);

	GET_PROP(price);

#undef GET_PROP
}
예제 #2
0
CDlgUnderComp::CDlgUnderComp(IUnderComp* underComp, CWnd* pParent /*=NULL*/)
    : CDialog(CDlgUnderComp::IDD, pParent)
    , m_underComp(underComp)
{
    IUnderComp* comUnderComp = m_underComp;

    typedef CComPropAccessor<IUnderComp> Props;

#define GET_PROP(Prop) \
	Props::Get(m_##Prop, comUnderComp, &IUnderComp::get_##Prop);

    GET_PROP(conId);
    GET_PROP(delta);
    GET_PROP(price);

#undef GET_PROP
}
예제 #3
0
파일: proof.c 프로젝트: HUST-PLT/cyclist
//==================================================================
Proof::Proof(size_t maxv_l2) :
	dict( new spot::bdd_dict() ),
	max_vertices_log2(maxv_l2),
	max_tag(0),
	last_vertex(0),
	initial_vertex(NO_VERTEX) {
	for(size_t i=0; i<max_vertices_log2; ++i) {
		std::stringstream ss;
		ss << "p_" << i;
		propositions.push_back( GET_PROP(dict, ss.str(), this ) );
	}
}
예제 #4
0
bool find_cache_operators::enter_node(
	boost::shared_ptr<op_node> node)
{
	try
	{
		if (node->has_property(PROP_TRANSFORMED))
		{
			qoperator* op = GET_PROP(node, TRANSFORMED);
			if (dynamic_cast<cache_operator*>(op))
				m_ops.push_back(node);
		}
		return true;
	}
	catch (boost::bad_any_cast& ex)
	{
		LOG_ERROR(ex.what());
	}

}
예제 #5
0
source* translator_proactive_adapt::translate_source(
	boost::shared_ptr<op_node> source_node)
{
	try
	{
		std::string stream_name = GET_PROP(source_node, STREAM_NAME);
		std::map<std::string, source*>::iterator result_it= m_sources.find(stream_name);
		if (result_it == m_sources.end())
		{
			LOG_ERROR("source_map doesn't contain a stream source with name " << stream_name);
			return NULL;
		}
		return result_it->second;
	}
	catch (boost::bad_any_cast& ex)
	{
		LOG_ERROR(ex.what());
	}
	return NULL;
}
예제 #6
0
bool fill_smoothing_visitor::enter_node(
	op_node_ptr node)
{
	try
	{
		if (node->has_property(PROP_SMOOTHING))
		{
			set_smoothing_visitor::smoothing_ptr smooth = GET_PROP(node, SMOOTHING);

			for (unsigned int i = 0; i < m_cycles; ++i)
				smooth->set_current(smooth->get_next());
		}

		return true;
	}
	catch (boost::bad_any_cast& ex)
	{
		LOG_ERROR(ex.what());
	}

}
예제 #7
0
CDlgScanner::CDlgScanner( ScannerSubscription* subscription, EClient* client, CWnd* pParent )
	: CDialog( CDlgScanner::IDD, pParent )
	, m_client( client )
	, m_subscription( subscription )

{
	//{{AFX_DATA_INIT(CDlgScanner)
	m_id = 0;
	//}}AFX_DATA_INIT

#define GET_PROP(Prop) \
   m_##Prop = subscription->Prop;

	GET_PROP( instrument );
	GET_PROP( locationCode );
	GET_PROP( scanCode );
	GET_PROP( numberOfRows );

	GET_PROP( abovePrice );
	GET_PROP( belowPrice );
	GET_PROP( aboveVolume );
	GET_PROP( averageOptionVolumeAbove );
	GET_PROP( marketCapAbove );
	GET_PROP( marketCapBelow );
	GET_PROP( moodyRatingAbove );
	GET_PROP( moodyRatingBelow );
	GET_PROP( spRatingAbove );
	GET_PROP( spRatingBelow );
	GET_PROP( maturityDateAbove );
	GET_PROP( maturityDateBelow );
	GET_PROP( couponRateAbove );
	GET_PROP( couponRateBelow );
	GET_PROP( excludeConvertible );
	GET_PROP( scannerSettingPairs );
	GET_PROP( stockTypeFilter );

#undef GET_PROP
}
예제 #8
0
파일: cookiejar.c 프로젝트: stuartpb/retik
static SoupCookie*
cookie_new_from_table(lua_State *L, gint idx, gchar **error)
{
    SoupCookie *cookie = NULL;
    SoupDate *date;
    const gchar *name, *value, *domain, *path;
    name = value = domain = path = NULL;
    gboolean secure, http_only;
    gint expires;

    /* correct relative index */
    if (idx < 0)
        idx = lua_gettop(L) + idx + 1;

    /* check for cookie table */
    if (!lua_istable(L, idx)) {
        *error = g_strdup_printf("invalid cookie table, got %s",
            lua_typename(L, lua_type(L, idx)));
        return NULL;
    }

#define IS_STRING  (lua_isstring(L, -1)  || lua_isnumber(L, -1))
#define IS_BOOLEAN (lua_isboolean(L, -1) || lua_isnil(L, -1))
#define IS_NUMBER  (lua_isnumber(L, -1))

#define GET_PROP(prop, typname, typexpr, typfunc)                           \
    lua_pushliteral(L, #prop);                                              \
    lua_rawget(L, idx);                                                     \
    if ((typexpr)) {                                                        \
        prop = typfunc(L, -1);                                              \
        lua_pop(L, 1);                                                      \
    } else {                                                                \
        *error = g_strdup_printf("invalid cookie." #prop " type, expected " \
            #typname ", got %s",  lua_typename(L, lua_type(L, -1)));        \
        return NULL;                                                        \
    }

    /* get cookie properties */
    GET_PROP(name,      string,  IS_STRING,  lua_tostring)
    GET_PROP(value,     string,  IS_STRING,  lua_tostring)
    GET_PROP(domain,    string,  IS_STRING,  lua_tostring)
    GET_PROP(path,      string,  IS_STRING,  lua_tostring)
    GET_PROP(secure,    boolean, IS_BOOLEAN, lua_toboolean)
    GET_PROP(http_only, boolean, IS_BOOLEAN, lua_toboolean)
    GET_PROP(expires,   number,  IS_NUMBER,  lua_tonumber)

#undef IS_STRING
#undef IS_BOOLEAN
#undef IS_NUMBER
#undef GET_PROP

    /* create soup cookie */
    if ((cookie = soup_cookie_new(name, value, domain, path, expires))) {
        soup_cookie_set_secure(cookie, secure);
        soup_cookie_set_http_only(cookie, http_only);

        /* set real expiry date from unixtime */
        if (expires > 0) {
            date = soup_date_new_from_time_t((time_t) expires);
            soup_cookie_set_expires(cookie, date);
            soup_date_free(date);
        }

        return cookie;
    }

    /* soup cookie creation failed */
    *error = g_strdup_printf("soup cookie creation failed");
    return NULL;
}
예제 #9
0
void CDlgAccount::updatePortfolio(IDispatch* dispContract, int position,
								  double marketPrice, double marketValue,
								  double averageCost, double unrealizedPNL,
								  double realizedPNL, const CString& accountName)
{
	CComQIPtr<IContract> contract(dispContract);

	if (!contract) {
		return;
	}

	int     conId;
	CString symbol;
	CString secType;
	CString expiry;
	double strike;
	CString right;
	CString multiplier;
	CString primaryExchange;
	CString currency;
	CString localSymbol;
	CString tradingClass;

	typedef CComPropAccessor<IContract> Props;

#define GET_PROP(Prop) \
	Props::Get(Prop, contract, &IContract::get_##Prop);

	GET_PROP(conId);
	GET_PROP(symbol);
	GET_PROP(secType);
	GET_PROP(expiry);
	GET_PROP(strike);
	GET_PROP(right);
	GET_PROP(multiplier);
	GET_PROP(primaryExchange);
	GET_PROP(currency);
	GET_PROP(localSymbol);
	GET_PROP(tradingClass);

#undef GET_PROP

    CString str;
	str.Format( "conId=%i symbol=%s  secType=%s  expiry=%s  strike=%f right=%s multiplier=%s primaryExchange=%s currency=%s localSymbol=%s tradingClass=%s"
		" position=%i mktPrice=%f mktValue=%f averageCost=%f unrealizedPNL=%f realizedPNL=%f account name=%s",
		conId, (const char *)symbol, (const char *)secType, (const char *)expiry, strike, (const char *)right,
		(const char*)multiplier, (const char*)primaryExchange, (const char *)currency, (const char *)localSymbol, (const char *)tradingClass,
		position, marketPrice, marketValue, averageCost, unrealizedPNL, realizedPNL,
		accountName);

    if ( m_portfolio.m_hWnd != NULL ) {
	    m_portfolio.InsertString(0, str);
    }
}