本文整理汇总了C++中Translator::getClientPrice方法的典型用法代码示例。如果您正苦于以下问题:C++ Translator::getClientPrice方法的具体用法?C++ Translator::getClientPrice怎么用?C++ Translator::getClientPrice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Translator
的用法示例。
在下文中一共展示了Translator::getClientPrice方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: logic_error
// SessionManager must be read-locked
Call::Call(SessionManager *_sManager, unsigned int _id, unsigned int _client, unsigned int _translator, string lang)
: sManager(_sManager),
id(_id),
client(_client),
translator(_translator),
state(INIT),
start_time(0), end_time(0), accounted(0),
cost(0),
price(0),
client_balance(0)
{
pthread_mutex_init(&mutex, 0);
Session *cs = sManager->findSessionByUser(_client);
if (!cs)
throw logic_error("Client session not found.");
if (!dynamic_cast<Client *>(cs->getUser()) ||
(!TRANSLATORS_CALL && dynamic_cast<Translator *>(cs->getUser())))
throw logic_error("Client not found.");
Client *c = dynamic_cast<Client *>(cs->getUser());
clientName = c->getName();
Session *ts = sManager->findSessionByUser(_translator);
if (!ts)
throw logic_error("Translator session not found.");
Translator *t = dynamic_cast<Translator *>(ts->getUser());
if (!t)
throw logic_error("Translator not found.");
setTranslateLang(lang);
setClientLang(t->getCommonLang(c));
price = t->getClientPrice(c, lang);
translatorName = t->getName();
}