本文整理汇总了C++中Assembly类的典型用法代码示例。如果您正苦于以下问题:C++ Assembly类的具体用法?C++ Assembly怎么用?C++ Assembly使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Assembly类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Assembly
Assembly *Assembly::create(LSLuaState *vm, const utString& name)
{
Assembly *a = new Assembly();
a->vm = vm;
a->name = name;
utHashTable<utHashedString, Assembly *> *lookup = NULL;
UTsize idx = assemblies.find(vm);
if (idx != UT_NPOS)
{
lookup = assemblies.at(idx);
}
else
{
lookup = new utHashTable<utHashedString, Assembly *>();
assemblies.insert(vm, lookup);
}
utHashedString key = a->name;
lookup->insert(key, a);
vm->assemblies.insert(utHashedString(a->getName()), a);
return a;
}
示例2: Assembly
Assembly *GraspGLObjects::CreateRollPrompt( double radius ) {
Assembly *prompt = new Assembly();
// Angular extent of the circular arrow, where 1.0 = 360°.
double guage = radius / 10.0;
double arc = 0.85;
Annulus *donut = new Annulus( radius, guage, arc, curve_facets, curve_facets );
donut->SetAttitude( 0.0, 90.0, 0.0 );
prompt->AddComponent( donut );
TaperedAnnulus *tip = new TaperedAnnulus( radius, radius / 3.0, 1.0, 0.05, curve_facets );
tip->SetAttitude( 0.0, 90.0, 0.0 );
tip->SetOrientation( - arc * 360.0, 0.0, 0.0 );
prompt->AddComponent( tip );
Ellipsoid *base = new Ellipsoid ( guage, guage / 2.0, guage );
base->SetPosition( radius, 0.0, 0.0 );
prompt->AddComponent( base );
prompt->SetColor( 0.5, 0.5, 0.5, 0.5 );
return prompt;
}
示例3: LSMapFile
Assembly *LSLuaState::loadExecutableAssembly(const utString& assemblyName, bool absPath)
{
// executables always in bin
utString filePath;
if (!absPath)
{
filePath = "./bin/";
}
filePath += assemblyName;
if (!strstr(filePath.c_str(), ".loom"))
{
filePath += ".loom";
}
const char *buffer = NULL;
long bufferSize;
LSMapFile(filePath.c_str(), (void **)&buffer, &bufferSize);
lmAssert(buffer && bufferSize, "Error loading executable: %s, unable to map file", assemblyName.c_str());
Assembly* assembly = loadExecutableAssemblyBinary(buffer, bufferSize);
LSUnmapFile(filePath.c_str());
lmAssert(assembly, "Error loading executable: %s", assemblyName.c_str());
assembly->freeByteCode();
return assembly;
}
示例4: FCIMPL3
FCIMPL3(Object*, AppDomainNative::CreateDynamicAssembly, AssemblyNameBaseObject* assemblyNameUNSAFE, StackCrawlMark* stackMark, INT32 access)
{
FCALL_CONTRACT;
ASSEMBLYREF refRetVal = NULL;
//<TODO>
// @TODO: there MUST be a better way to do this...
//</TODO>
CreateDynamicAssemblyArgs args;
args.assemblyName = (ASSEMBLYNAMEREF) assemblyNameUNSAFE;
args.loaderAllocator = NULL;
args.access = access;
args.stackMark = stackMark;
HELPER_METHOD_FRAME_BEGIN_RET_PROTECT((CreateDynamicAssemblyArgsGC&)args);
Assembly *pAssembly = Assembly::CreateDynamic(GetAppDomain(), &args);
refRetVal = (ASSEMBLYREF) pAssembly->GetExposedObject();
HELPER_METHOD_FRAME_END();
return OBJECTREFToObject(refRetVal);
}
示例5: add_assembly
void Object::add_assembly(Assembly ab)
{
v_ab.push_back(ab);
v_kd.push_back(ab.getkd());
v_ks.push_back(ab.getks());
v_shininess.push_back(ab.getshininess());
}
示例6: getPackageTypes
// get all types loaded for a given package
void LSLuaState::getPackageTypes(const utString& packageName,
utArray<Type *>& types)
{
for (UTsize i = 0; i < assemblies.size(); i++)
{
Assembly *assembly = assemblies.at(i);
assembly->getPackageTypes(packageName, types);
}
}
示例7: bind_assembly_entity_to_input
void InputBinder::bind_assembly_entity_to_input(
const Scene& scene,
const SymbolTable& scene_symbols,
const Assembly& assembly,
const SymbolTable& assembly_symbols,
const char* entity_type,
const char* entity_name,
const char* param_value,
InputArray::iterator& input)
{
switch (assembly_symbols.lookup(param_value))
{
case SymbolTable::SymbolColor:
bind_color_to_input(
assembly.colors(),
param_value,
input);
break;
case SymbolTable::SymbolTextureInstance:
bind_texture_instance_to_input(
assembly.textures(),
assembly.texture_instances(),
assembly.get_uid(),
entity_type,
entity_name,
param_value,
input);
break;
case SymbolTable::SymbolNotFound:
// No entity with this name was found in this scope.
// Attempt to bind the input to a scene entity.
bind_scene_entity_to_input(
scene,
scene_symbols,
entity_type,
entity_name,
param_value,
input);
break;
default:
RENDERER_LOG_ERROR(
"while defining %s \"%s\": cannot bind \"%s\" to parameter \"%s\".",
entity_type,
entity_name,
param_value,
input.name());
++m_error_count;
break;
}
}
示例8: BINDER_LOG_ENTER
HRESULT BindingLog::LogResult(BindResult *pBindResult)
{
HRESULT hr = S_OK;
BINDER_LOG_ENTER(L"BindingLog::LogResult");
PathString assemblyDisplayName;
PathString format;
PathString info;
pBindResult->GetAssemblyName()->GetDisplayName(assemblyDisplayName,
AssemblyName::INCLUDE_VERSION |
AssemblyName::INCLUDE_ARCHITECTURE);
IF_FAIL_GO(format.LoadResourceAndReturnHR(CCompRC::Debugging,
ID_FUSLOG_ASSEMBLY_STATUS_BOUND_TO_ID));
info.Printf(format.GetUnicode(), assemblyDisplayName.GetUnicode());
IF_FAIL_GO(Log(info));
IUnknown *pIUnknownAssembly;
pIUnknownAssembly = pBindResult->GetAssembly(FALSE /* fAddRef */);
Assembly *pAssembly;
pAssembly = static_cast<Assembly *>(static_cast<void *>(pIUnknownAssembly));
_ASSERTE(pAssembly != NULL);
if (pAssembly->GetIsInGAC())
{
IF_FAIL_GO(info.
LoadResourceAndReturnHR(CCompRC::Debugging,
ID_FUSLOG_ASSEMBLY_STATUS_BOUND_GAC));
}
else if (pAssembly->GetIsByteArray())
{
IF_FAIL_GO(info.
LoadResourceAndReturnHR(CCompRC::Debugging,
ID_FUSLOG_ASSEMBLY_STATUS_BOUND_BYTE_ARRAY));
}
else
{
PathString assemblyPath;
BinderGetImagePath(pAssembly->GetPEImage(), assemblyPath);
IF_FAIL_GO(format.
LoadResourceAndReturnHR(CCompRC::Debugging,
ID_FUSLOG_ASSEMBLY_STATUS_BOUND_TO_LOCATION));
info.Printf(format.GetUnicode(), assemblyPath.GetUnicode());
}
IF_FAIL_GO(Log(info));
Exit:
BINDER_LOG_LEAVE_HR(L"BindingLog::LogResult", hr);
return hr;
}
示例9: ParseLine
bool Assembler::ParseLine(string& line, int linecount, Assembly& assembly, LabelVector& labels)
{
string op;
int i = NextWord(line, op);
// skip commented and empty lines
if(i == -1 || op == "//" || op == ";") return true;
// this is a a very slow way of doing things, but then this code will only
// be used during development and for debugging
OpDesc *opcode;
int codecount = sizeof(opcodes)/sizeof(OpDesc);
int j = 0;
for(; j < codecount; j ++) {
if(stricmp(opcodes[j].name, op.c_str()) == 0) {
opcode = &opcodes[j];
break;
}
}
// is this a label?
if(j == codecount) {
size_t k = op.length() - 1;
if(op.find_first_of(":") == k) {
string name = op.substr(0, k);
labels.at(AddLabel(name, labels)).pos = assembly.curpos;
return true;
} else
return false;
} else {
assembly.WriteDword(opcode->code);
string param;
i = NextWord(line, param, i);
if(IsJumpOp(opcode->code)) {
// write the label index, we'll later replace this with the code position
assembly.WriteDword(AddLabel(param, labels));
} else {
if(i == -1) {
assembly.WriteDword(0);
if(opcode->paramcount > 0) return false; // if we need more params, bail
} else
assembly.WriteDword(StringToOperand(param, opcode));
}
}
return true;
}
示例10: loadBytes
int Assembly::loadBytes(lua_State *L) {
utByteArray *bytes = static_cast<utByteArray*>(lualoom_getnativepointer(L, 1, false, "system.ByteArray"));
Assembly *assembly = LSLuaState::getExecutingVM(L)->loadExecutableAssemblyBinary(static_cast<const char*>(bytes->getDataPtr()), bytes->getSize());
lmAssert(assembly, "Error loading assembly bytes");
lualoom_pushnative(L, assembly);
assembly->freeByteCode();
return 1;
}
示例11: beginAssemblyLoad
Assembly *LSLuaState::loadTypeAssembly(const utString& assemblyString)
{
beginAssemblyLoad();
Assembly *assembly = Assembly::loadFromString(this, assemblyString);
utArray<Type *> types;
assembly->getTypes(types);
cacheAssemblyTypes(assembly, types);
endAssemblyLoad();
return assembly;
}
示例12: RunBenchmarks
void RunBenchmarks()
{
LSCompiler::setRootBuildFile("Benchmarks.build");
LSCompiler::initialize();
LSLuaState *benchVM = new LSLuaState();
benchVM->open();
Assembly *benchAssembly = benchVM->loadExecutableAssembly("Benchmarks.loom");
benchAssembly->execute();
benchVM->close();
}
示例13: finalize_assembly
void finalize_assembly(Assembly& assembly) override
{
// Insert the baked mesh object into the assembly.
assembly.objects().insert(auto_release_ptr<Object>(m_mesh));
// Instantiate the baked mesh object.
assembly.object_instances().insert(
ObjectInstanceFactory::create(
"cubes_instance",
ParamArray(),
"cubes",
Transformd::identity(),
StringDictionary()
.insert("default", "cubes_material")));
}
示例14: RunUnitTests
void RunUnitTests()
{
LSCompiler::setRootBuildFile("Tests.build");
LSCompiler::initialize();
LSLuaState *testVM = new LSLuaState();
// FIXME: default paths
testVM->open();
Assembly *testAssembly = testVM->loadExecutableAssembly("Tests.loom");
testAssembly->execute();
testVM->close();
}
示例15: FCIMPL4
FCIMPLEND
#endif // !FEATURE_CORECLR
FCIMPL4(void, AssemblyNameNative::Init, Object * refThisUNSAFE, OBJECTREF * pAssemblyRef, CLR_BOOL fForIntrospection, CLR_BOOL fRaiseResolveEvent)
{
FCALL_CONTRACT;
ASSEMBLYNAMEREF pThis = (ASSEMBLYNAMEREF) (OBJECTREF) refThisUNSAFE;
HRESULT hr = S_OK;
HELPER_METHOD_FRAME_BEGIN_1(pThis);
*pAssemblyRef = NULL;
if (pThis == NULL)
COMPlusThrow(kNullReferenceException, W("NullReference_This"));
Thread * pThread = GetThread();
CheckPointHolder cph(pThread->m_MarshalAlloc.GetCheckpoint()); //hold checkpoint for autorelease
AssemblySpec spec;
hr = spec.InitializeSpec(&(pThread->m_MarshalAlloc), (ASSEMBLYNAMEREF *) &pThis, TRUE, FALSE);
if (SUCCEEDED(hr))
{
spec.AssemblyNameInit(&pThis,NULL);
}
else if ((hr == FUSION_E_INVALID_NAME) && fRaiseResolveEvent)
{
Assembly * pAssembly = GetAppDomain()->RaiseAssemblyResolveEvent(&spec, fForIntrospection, FALSE);
if (pAssembly == NULL)
{
EEFileLoadException::Throw(&spec, hr);
}
else
{
*((OBJECTREF *) (&(*pAssemblyRef))) = pAssembly->GetExposedObject();
}
}
else
{
ThrowHR(hr);
}
HELPER_METHOD_FRAME_END();
}