/*---------------------------------------------------------------------------* Project: Horizon File: ro_Module.h Copyright (C)2009-2012 Nintendo Co., Ltd. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Rev: 47425 $ *---------------------------------------------------------------------------*/ #ifndef NN_RO_RO_MODULE_H_ #define NN_RO_RO_MODULE_H_ #include #include #include #include #include namespace nn { namespace ro { //--------------------------------------------------------------------------- // // // // // // // //--------------------------------------------------------------------------- class Module : private util::NonCopyable { private: uptr m_Dummy; public: //---------------------------------------------------------------------- // // // // // // //---------------------------------------------------------------------- class EnumerateCallback { public: //---------------------------------------------------------------------- // // // // // // // // // // // //---------------------------------------------------------------------- virtual bool operator()(Module* p) = 0; }; public: ~Module() { Unload(); } void operator delete(void* p) { NN_UNUSED_VAR(p); // Does nothing } //--------------------------------------------------------------------------- // // // // // // // // // // // //--------------------------------------------------------------------------- Result Link(); //--------------------------------------------------------------------------- // //--------------------------------------------------------------------------- Result Unlink(); //--------------------------------------------------------------------------- // // // // // // // // // // // // // // // // // // // // // // //--------------------------------------------------------------------------- Result Unload(); //--------------------------------------------------------------------------- // // // // // // // // // // // // //--------------------------------------------------------------------------- bool IsAllSymbolResolved() const; //--------------------------------------------------------------------------- // // // // // // //--------------------------------------------------------------------------- const char* GetName() const; //--------------------------------------------------------------------------- // // // // // // // // //--------------------------------------------------------------------------- void DoInitialize(); //--------------------------------------------------------------------------- // // // // // // // // //--------------------------------------------------------------------------- void DoFinalize(); //--------------------------------------------------------------------------- // // // // // // // // // // // // // // //--------------------------------------------------------------------------- template T GetPointer(const char* name) const { return reinterpret_cast(GetAddress(name)); } //--------------------------------------------------------------------------- // // // // // // // // // // // // //--------------------------------------------------------------------------- template T GetPointer(s32 index) const { return reinterpret_cast(GetAddress(index)); } //--------------------------------------------------------------------------- // // // //--------------------------------------------------------------------------- void GetRegionInfo(RegionInfo* pri); //--------------------------------------------------------------------------- // // // // // // // // // // //--------------------------------------------------------------------------- static void Enumerate(EnumerateCallback* p); //--------------------------------------------------------------------------- // // // // // // // // // // // //--------------------------------------------------------------------------- static Module* Find(const char* pName); private: Module(); void* operator new(size_t size) throw (); uptr GetAddress(const char* name) const; uptr GetAddress(s32 index) const; uptr GetHead() { return reinterpret_cast(this); } }; } // end of namespace ro } // end of namespace nn #endif // ifndef NN_RO_RO_MODULE_H_