本文整理汇总了C++中logvisor::Module类的典型用法代码示例。如果您正苦于以下问题:C++ Module类的具体用法?C++ Module怎么用?C++ Module使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Module类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AthenaExcHandler
void AthenaExcHandler(athena::error::Level level, const char* file, const char* /*function*/, int line, const char* fmt,
...) {
static logvisor::Module Log("heclTest::AthenaExcHandler");
va_list ap;
va_start(ap, fmt);
Log.reportSource(logvisor::Level(level), file, uint32_t(line), fmt, ap);
va_end(ap);
}
示例2: Log
namespace urde {
logvisor::Module Log("urde::RetroTypes::CAssetId");
CAssetId::CAssetId(CInputStream& in) {
if (g_Main) {
if (g_Main->GetExpectedIdSize() == sizeof(u32))
Assign(in.readUint32Big());
else if (g_Main->GetExpectedIdSize() == sizeof(u64))
Assign(in.readUint64Big());
else
Log.report(logvisor::Fatal, "Unsupported id length %i", g_Main->GetExpectedIdSize());
} else
Log.report(logvisor::Fatal, "Input constructor called before runtime Main entered!");
}
void CAssetId::PutTo(COutputStream& out) {
if (g_Main) {
if (g_Main->GetExpectedIdSize() == sizeof(u32))
out.writeUint32Big(u32(id));
else if (g_Main->GetExpectedIdSize() == sizeof(u64))
out.writeUint64Big(id);
else
Log.report(logvisor::Fatal, "Unsupported id length %i", g_Main->GetExpectedIdSize());
} else
Log.report(logvisor::Fatal, "PutTo called before runtime Main entered!");
}
} // namespace urde
示例3: read
void ColorElementFactory::read(athena::io::IStreamReader& r)
{
uint32_t clsId;
r.readBytesToBuf(&clsId, 4);
switch (clsId)
{
case SBIG('KEYE'):
case SBIG('KEYP'):
m_elem.reset(new struct CEKeyframeEmitter);
break;
case SBIG('CNST'):
m_elem.reset(new struct CEConstant);
break;
case SBIG('CHAN'):
m_elem.reset(new struct CETimeChain);
break;
case SBIG('CFDE'):
m_elem.reset(new struct CEFadeEnd);
break;
case SBIG('FADE'):
m_elem.reset(new struct CEFade);
break;
case SBIG('PULS'):
m_elem.reset(new struct CEPulse);
break;
case SBIG('NONE'):
m_elem.reset();
return;
default:
m_elem.reset();
LogModule.report(logvisor::Fatal, "Unknown ColorElement class %.4s @%" PRIi64, &clsId, r.position());
return;
}
m_elem->read(r);
}
示例4: Log
namespace boo {
static logvisor::Module Log("boo::GLX");
void GLXExtensionCheck() {
if (!GLXEW_SGI_video_sync)
Log.report(logvisor::Fatal, "GLX_SGI_video_sync not available");
if (!GLXEW_EXT_swap_control && !GLXEW_MESA_swap_control && !GLXEW_SGI_swap_control)
Log.report(logvisor::Fatal, "swap_control not available");
}
void GLXEnableVSync(Display* disp, GLXWindow drawable) {
if (GLXEW_EXT_swap_control)
glXSwapIntervalEXT(disp, drawable, 1);
else if (GLXEW_MESA_swap_control)
glXSwapIntervalMESA(1);
else if (GLXEW_SGI_swap_control)
glXSwapIntervalSGI(1);
}
} // namespace boo
示例5: Log
namespace urde
{
static logvisor::Module Log("urde::CGuiWidget");
typedef bool(CGuiWidget::*FMAF)(CGuiFunctionDef* def, CGuiControllerInfo* info);
static std::unordered_map<u32, FMAF> WidgetFnMap;
void CGuiWidget::LoadWidgetFnMap()
{
WidgetFnMap.emplace(std::make_pair(2, &CGuiWidget::MAF_StartAnimationSet));
WidgetFnMap.emplace(std::make_pair(3, &CGuiWidget::MAF_SendMessage));
WidgetFnMap.emplace(std::make_pair(6, &CGuiWidget::MAF_PauseAnim));
WidgetFnMap.emplace(std::make_pair(7, &CGuiWidget::MAF_ResumeAnim));
WidgetFnMap.emplace(std::make_pair(11, &CGuiWidget::MAF_SetState));
WidgetFnMap.emplace(std::make_pair(12, &CGuiWidget::MAF_SetStateOfWidget));
}
CGuiWidget::CGuiWidget(const CGuiWidgetParms& parms)
: x7c_selfId(parms.x6_selfId), x7e_parentId(parms.x8_parentId),
xbc_color(parms.x10_color), xc0_color2(parms.x10_color),
xc4_drawFlags(parms.x14_drawFlags), xc8_frame(parms.x0_frame),
xf6_24_pg(parms.xd_g), xf6_25_isVisible(parms.xa_defaultVisible),
xf6_26_isActive(parms.xb_defaultActive),
xf6_27_(true), xf6_28_eventLock(false),
xf6_29_cullFaces(parms.xc_cullFaces), xf6_30_(false),
xf6_31_(true), xf7_24_(false), xf7_25_(true)
{
if (parms.x4_useAnimController)
EnsureHasAnimController();
RecalcWidgetColor(ETraversalMode::Single);
}
CGuiWidget::CGuiWidgetParms
CGuiWidget::ReadWidgetHeader(CGuiFrame* frame, CInputStream& in, bool flag)
{
std::string name = in.readString(-1);
s16 selfId = frame->GetWidgetIdDB().AddWidget(name);
std::string parent = in.readString(-1);
s16 parentId = frame->GetWidgetIdDB().AddWidget(parent);
bool useAnimController = in.readBool();
bool defaultVis = in.readBool();
bool defaultActive = in.readBool();
bool cullFaces = in.readBool();
zeus::CColor color;
color.readRGBABig(in);
EGuiModelDrawFlags df = EGuiModelDrawFlags(in.readUint32Big());
return CGuiWidget::CGuiWidgetParms(frame, useAnimController, selfId,
parentId, defaultVis, defaultActive,
cullFaces, color, df, true, flag);
}
CGuiWidget* CGuiWidget::Create(CGuiFrame* frame, CInputStream& in, bool flag)
{
CGuiWidgetParms parms = ReadWidgetHeader(frame, in, flag);
CGuiWidget* ret = new CGuiWidget(parms);
ret->ParseBaseInfo(frame, in, parms);
return ret;
}
bool CGuiWidget::Message(const CGuiMessage& msg)
{
}
void CGuiWidget::ParseBaseInfo(CGuiFrame* frame, CInputStream& in, const CGuiWidgetParms& parms)
{
CGuiWidget* parent = frame->FindWidget(parms.x8_parentId);
bool a = in.readBool();
if (a)
xf4_workerId = in.readInt16Big();
zeus::CVector3f trans;
trans.readBig(in);
zeus::CMatrix3f orient;
orient.readBig(in);
x80_transform = zeus::CTransform(orient, trans);
ReapplyXform();
zeus::CVector3f rotCenter;
rotCenter.readBig(in);
SetRotationCenter(rotCenter);
ParseMessages(in, parms);
ParseAnimations(in, parms);
if (a)
if (!parent->AddWorkerWidget(this))
{
Log.report(logvisor::Warning,
"Warning: Discarding useless worker id. Parent is not a compound widget.");
xf4_workerId = -1;
}
parent->AddChildWidget(this, false, true);
}
void CGuiWidget::ParseMessages(CInputStream& in, const CGuiWidgetParms& parms)
{
s16 count = in.readInt16Big();
assert(count == 0);
count = in.readInt16Big();
assert(count == 0);
}
//.........这里部分代码省略.........
示例6: Log
namespace urde
{
static logvisor::Module Log("URDE::icons");
specter::IconAtlas<8,8> g_IconAtlas;
boo::GraphicsDataToken InitializeIcons(specter::ViewResources& viewRes)
{
athena::io::MemoryReader r(URDE_ICONS, URDE_ICONS_SZ);
size_t fmt = r.readUint32Big();
if (fmt != 16)
Log.report(logvisor::Fatal, "incorrect icon texture format");
size_t width = r.readUint16Big();
size_t height = r.readUint16Big();
size_t mips = r.readUint32Big();
size_t decompSz = r.readUint32Big();
std::unique_ptr<uint8_t[]> texels(new uint8_t[decompSz]);
uLongf destSz = decompSz;
size_t pos = r.position();
if (uncompress(texels.get(), &destSz, URDE_ICONS + pos, URDE_ICONS_SZ - pos) != Z_OK)
Log.report(logvisor::Fatal, "unable to decompress icons");
g_IconAtlas.initializeAtlas(viewRes.m_factory->newStaticTexture(width, height, mips, boo::TextureFormat::RGBA8,
texels.get(), destSz));
return viewRes.m_factory->commit();
}
specter::Icon& GetIcon(SpaceIcon icon)
{
switch (icon)
{
case SpaceIcon::ResourceBrowser:
return g_IconAtlas.getIcon(0, 0);
case SpaceIcon::ParticleEditor:
return g_IconAtlas.getIcon(0, 1);
case SpaceIcon::WorldEditor:
return g_IconAtlas.getIcon(0, 2);
case SpaceIcon::InformationCenter:
return g_IconAtlas.getIcon(0, 3);
case SpaceIcon::ModelViewer:
return g_IconAtlas.getIcon(0, 4);
default:
return g_IconAtlas.getIcon(6, 0);
}
}
specter::Icon& GetIcon(MonoIcon icon)
{
switch (icon)
{
case MonoIcon::Sync:
return g_IconAtlas.getIcon(7, 0);
case MonoIcon::Edit:
return g_IconAtlas.getIcon(7, 1);
case MonoIcon::Caution:
return g_IconAtlas.getIcon(7, 2);
case MonoIcon::Save:
return g_IconAtlas.getIcon(7, 3);
case MonoIcon::Filter:
return g_IconAtlas.getIcon(7, 4);
case MonoIcon::Document:
return g_IconAtlas.getIcon(7, 5);
case MonoIcon::ZoomOut:
return g_IconAtlas.getIcon(7, 6);
case MonoIcon::ZoomIn:
return g_IconAtlas.getIcon(7, 7);
case MonoIcon::Exclaim:
return g_IconAtlas.getIcon(6, 0);
case MonoIcon::Clock:
return g_IconAtlas.getIcon(6, 1);
case MonoIcon::Gamepad:
return g_IconAtlas.getIcon(6, 2);
case MonoIcon::Unlink:
return g_IconAtlas.getIcon(6, 3);
case MonoIcon::Link:
return g_IconAtlas.getIcon(6, 4);
case MonoIcon::Folder:
return g_IconAtlas.getIcon(6, 5);
case MonoIcon::Info:
return g_IconAtlas.getIcon(6, 6);
default:
return g_IconAtlas.getIcon(6, 0);
}
}
}
示例7: Log
namespace specter
{
static logvisor::Module Log("specter::ViewResources");
void ViewResources::init(boo::IGraphicsDataFactory* factory, FontCache* fcache,
const IThemeData* theme, float pf)
{
if (!factory || !fcache || !theme)
Log.report(logvisor::Fatal, "all arguments of ViewResources::init() must be non-null");
m_pixelFactor = pf;
m_factory = factory;
m_theme = theme;
m_fcache = fcache;
unsigned dpi = 72.f * m_pixelFactor;
m_curveFont = fcache->prepCurvesFont(factory, AllCharFilter, false, 8.f, dpi);
m_resData = factory->commitTransaction(
[&](boo::IGraphicsDataFactory::Context& ctx) -> bool
{
switch (ctx.platform())
{
case boo::IGraphicsDataFactory::Platform::OGL:
init<boo::GLDataFactory::Context>(static_cast<boo::GLDataFactory::Context&>(ctx), *theme, fcache);
break;
#if _WIN32
case boo::IGraphicsDataFactory::Platform::D3D11:
case boo::IGraphicsDataFactory::Platform::D3D12:
init<boo::ID3DDataFactory::Context>(static_cast<boo::ID3DDataFactory::Context&>(ctx), *theme, fcache);
break;
#endif
#if BOO_HAS_METAL
case boo::IGraphicsDataFactory::Platform::Metal:
init<boo::MetalDataFactory::Context>(static_cast<boo::MetalDataFactory::Context&>(ctx), *theme, fcache);
break;
#endif
#if BOO_HAS_VULKAN
case boo::IGraphicsDataFactory::Platform::Vulkan:
init<boo::VulkanDataFactory::Context>(static_cast<boo::VulkanDataFactory::Context&>(ctx), *theme, fcache);
break;
#endif
default:
Log.report(logvisor::Fatal, _S("unable to init view system for %s"), ctx.platformName());
}
return true;
});
}
void ViewResources::prepFontCacheSync()
{
unsigned dpi = 72.f * m_pixelFactor;
if (m_fcacheInterrupt) return;
m_mainFont = m_fcache->prepMainFont(m_factory, AllCharFilter, false, 10.f, dpi);
if (m_fcacheInterrupt) return;
m_monoFont = m_fcache->prepMonoFont(m_factory, AllCharFilter, false, 10.f, dpi);
if (m_fcacheInterrupt) return;
m_heading14 = m_fcache->prepMainFont(m_factory, LatinAndJapaneseCharFilter, false, 14.f, dpi);
if (m_fcacheInterrupt) return;
m_heading18 = m_fcache->prepMainFont(m_factory, LatinAndJapaneseCharFilter, false, 18.f, dpi);
if (m_fcacheInterrupt) return;
m_titleFont = m_fcache->prepMainFont(m_factory, LatinCharFilter, false, 36.f, dpi);
if (m_fcacheInterrupt) return;
m_fcache->closeBuiltinFonts();
m_fcacheReady = true;
}
void ViewResources::prepFontCacheAsync(boo::IWindow* window)
{
m_fcacheReady = false;
m_fcacheThread = std::thread([this, window]()
{
window->getLoadContextDataFactory();
prepFontCacheSync();
});
}
void ViewResources::resetPixelFactor(float pf)
{
m_pixelFactor = pf;
unsigned dpi = 72.f * m_pixelFactor;
m_curveFont = m_fcache->prepCurvesFont(m_factory, AllCharFilter, false, 8.f, dpi);
prepFontCacheSync();
}
void ViewResources::resetTheme(const IThemeData* theme)
{
m_theme = theme;
}
}
示例8: LogModule
namespace DNAParticle
{
logvisor::Module LogModule("urde::DNAParticle");
void RealElementFactory::read(athena::io::YAMLDocReader& r)
{
const auto& mapChildren = r.getCurNode()->m_mapChildren;
if (mapChildren.empty())
{
m_elem.reset();
return;
}
const auto& elem = mapChildren[0];
if (elem.first.size() < 4)
LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());
switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
{
case SBIG('LFTW'):
m_elem.reset(new struct RELifetimeTween);
break;
case SBIG('CNST'):
m_elem.reset(new struct REConstant);
break;
case SBIG('CHAN'):
m_elem.reset(new struct RETimeChain);
break;
case SBIG('ADD_'):
m_elem.reset(new struct REAdd);
break;
case SBIG('CLMP'):
m_elem.reset(new struct REClamp);
break;
case SBIG('KEYE'):
case SBIG('KEYP'):
m_elem.reset(new struct REKeyframeEmitter);
break;
case SBIG('IRND'):
m_elem.reset(new struct REInitialRandom);
break;
case SBIG('RAND'):
m_elem.reset(new struct RERandom);
break;
case SBIG('MULT'):
m_elem.reset(new struct REMultiply);
break;
case SBIG('PULS'):
m_elem.reset(new struct REPulse);
break;
case SBIG('SCAL'):
m_elem.reset(new struct RETimeScale);
break;
case SBIG('RLPT'):
m_elem.reset(new struct RELifetimePercent);
break;
case SBIG('SINE'):
m_elem.reset(new struct RESineWave);
break;
case SBIG('ISWT'):
m_elem.reset(new struct REInitialSwitch);
break;
case SBIG('CLTN'):
m_elem.reset(new struct RECompareLessThan);
break;
case SBIG('CEQL'):
m_elem.reset(new struct RECompareEquals);
break;
case SBIG('PAP1'):
m_elem.reset(new struct REParticleAdvanceParam1);
break;
case SBIG('PAP2'):
m_elem.reset(new struct REParticleAdvanceParam2);
break;
case SBIG('PAP3'):
m_elem.reset(new struct REParticleAdvanceParam3);
break;
case SBIG('PAP4'):
m_elem.reset(new struct REParticleAdvanceParam4);
break;
case SBIG('PAP5'):
m_elem.reset(new struct REParticleAdvanceParam5);
break;
case SBIG('PAP6'):
m_elem.reset(new struct REParticleAdvanceParam6);
break;
case SBIG('PAP7'):
m_elem.reset(new struct REParticleAdvanceParam7);
break;
case SBIG('PAP8'):
m_elem.reset(new struct REParticleAdvanceParam8);
break;
case SBIG('PSLL'):
m_elem.reset(new struct REParticleSizeOrLineLength);
break;
case SBIG('PRLW'):
m_elem.reset(new struct REParticleRotationOrLineWidth);
break;
case SBIG('SUB_'):
m_elem.reset(new struct RESubtract);
//.........这里部分代码省略.........
示例9: appMain
namespace urde
{
static logvisor::Module Log{"URDE"};
struct Application : boo::IApplicationCallback
{
hecl::Runtime::FileStoreManager m_fileMgr;
hecl::CVarManager m_cvarManager;
std::unique_ptr<ViewManager> m_viewManager;
bool m_running = true;
Application() :
m_fileMgr(_S("urde")),
m_cvarManager(m_fileMgr)
{
m_viewManager.reset(new ViewManager(m_fileMgr, m_cvarManager));
}
int appMain(boo::IApplication* app)
{
initialize(app);
m_viewManager->init(app);
while (m_running)
{
if (!m_viewManager->proc())
break;
}
m_viewManager->stop();
m_cvarManager.serialize();
m_viewManager.reset();
return 0;
}
void appQuitting(boo::IApplication*)
{
m_running = false;
}
void appFilesOpen(boo::IApplication*, const std::vector<boo::SystemString>&)
{
}
void initialize(boo::IApplication* app)
{
zeus::detectCPU();
const zeus::CPUInfo& cpuInf = zeus::cpuFeatures();
Log.report(logvisor::Info, "CPU Name: %s", cpuInf.cpuBrand);
Log.report(logvisor::Info, "CPU Vendor: %s", cpuInf.cpuVendor);
hecl::SystemString features;
if (cpuInf.AESNI)
features += _S("AES-NI");
if (cpuInf.SSE1)
{
if (!features.empty())
features += _S(", SSE1");
else
features += _S("SSE1");
}
else
{
Log.report(logvisor::Fatal, _S("URDE requires SSE1 minimum"));
return;
}
if (cpuInf.SSE2)
features += _S(", SSE2");
else
{
Log.report(logvisor::Fatal, _S("URDE requires SSE2 minimum"));
return;
}
if (cpuInf.SSE3)
features += _S(", SSE3");
if (cpuInf.SSSE3)
features += _S(", SSSE3");
if (cpuInf.SSE4a)
features += _S(", SSE4a");
if (cpuInf.SSE41)
features += _S(", SSE4.1");
if (cpuInf.SSE42)
features += _S(", SSE4.2");
Log.report(logvisor::Info, _S("CPU Features: %s"), features.c_str());
}
};
}
示例10: if
CAssetId::CAssetId(CInputStream& in) {
if (g_Main) {
if (g_Main->GetExpectedIdSize() == sizeof(u32))
Assign(in.readUint32Big());
else if (g_Main->GetExpectedIdSize() == sizeof(u64))
Assign(in.readUint64Big());
else
Log.report(logvisor::Fatal, "Unsupported id length %i", g_Main->GetExpectedIdSize());
} else
Log.report(logvisor::Fatal, "Input constructor called before runtime Main entered!");
}
示例11: PutTo
void CAssetId::PutTo(COutputStream& out) {
if (g_Main) {
if (g_Main->GetExpectedIdSize() == sizeof(u32))
out.writeUint32Big(u32(id));
else if (g_Main->GetExpectedIdSize() == sizeof(u64))
out.writeUint64Big(id);
else
Log.report(logvisor::Fatal, "Unsupported id length %i", g_Main->GetExpectedIdSize());
} else
Log.report(logvisor::Fatal, "PutTo called before runtime Main entered!");
}
示例12: ParseBaseInfo
void CGuiWidget::ParseBaseInfo(CGuiFrame* frame, CInputStream& in, const CGuiWidgetParms& parms)
{
CGuiWidget* parent = frame->FindWidget(parms.x8_parentId);
bool a = in.readBool();
if (a)
xf4_workerId = in.readInt16Big();
zeus::CVector3f trans;
trans.readBig(in);
zeus::CMatrix3f orient;
orient.readBig(in);
x80_transform = zeus::CTransform(orient, trans);
ReapplyXform();
zeus::CVector3f rotCenter;
rotCenter.readBig(in);
SetRotationCenter(rotCenter);
ParseMessages(in, parms);
ParseAnimations(in, parms);
if (a)
if (!parent->AddWorkerWidget(this))
{
Log.report(logvisor::Warning,
"Warning: Discarding useless worker id. Parent is not a compound widget.");
xf4_workerId = -1;
}
parent->AddChildWidget(this, false, true);
}
示例13:
Locale::Locale(const std::string& name, const std::string& fullName,
const unsigned char* yamlSource, size_t yamlLength)
: m_name(name), m_fullName(fullName)
{
athena::io::YAMLDocReader reader;
yaml_parser_set_input_string(reader.getParser(), yamlSource, yamlLength);
reader.parse();
m_rootNode = std::move(reader.releaseRootNode());
if (m_rootNode)
{
m_langNode = m_rootNode->findMapChild(name.c_str());
if (!m_langNode)
Log.report(logvisor::Fatal, "no root node '%s' found in locale", name.c_str());
}
else
Log.report(logvisor::Warning, "locale empty");
}
示例14: AthenaExc
static void AthenaExc(athena::error::Level level, const char* file,
const char*, int line, const char* fmt, ...)
{
va_list ap;
va_start(ap, fmt);
AthenaLog.reportSource(logvisor::Level(level), file, line, fmt, ap);
va_end(ap);
}
示例15: init
void ViewResources::init(boo::IGraphicsDataFactory* factory, FontCache* fcache,
const IThemeData* theme, float pf)
{
if (!factory || !fcache || !theme)
Log.report(logvisor::Fatal, "all arguments of ViewResources::init() must be non-null");
m_pixelFactor = pf;
m_factory = factory;
m_theme = theme;
m_fcache = fcache;
unsigned dpi = 72.f * m_pixelFactor;
m_curveFont = fcache->prepCurvesFont(factory, AllCharFilter, false, 8.f, dpi);
m_resData = factory->commitTransaction(
[&](boo::IGraphicsDataFactory::Context& ctx) -> bool
{
switch (ctx.platform())
{
case boo::IGraphicsDataFactory::Platform::OGL:
init<boo::GLDataFactory::Context>(static_cast<boo::GLDataFactory::Context&>(ctx), *theme, fcache);
break;
#if _WIN32
case boo::IGraphicsDataFactory::Platform::D3D11:
case boo::IGraphicsDataFactory::Platform::D3D12:
init<boo::ID3DDataFactory::Context>(static_cast<boo::ID3DDataFactory::Context&>(ctx), *theme, fcache);
break;
#endif
#if BOO_HAS_METAL
case boo::IGraphicsDataFactory::Platform::Metal:
init<boo::MetalDataFactory::Context>(static_cast<boo::MetalDataFactory::Context&>(ctx), *theme, fcache);
break;
#endif
#if BOO_HAS_VULKAN
case boo::IGraphicsDataFactory::Platform::Vulkan:
init<boo::VulkanDataFactory::Context>(static_cast<boo::VulkanDataFactory::Context&>(ctx), *theme, fcache);
break;
#endif
default:
Log.report(logvisor::Fatal, _S("unable to init view system for %s"), ctx.platformName());
}
return true;
});
}