|
| Pointer (void) |
| 預設建構子,建立一個空的 Pointer 物件
|
|
| Pointer (const void *pointer) |
| 建立一個 Pointer 物件,並以 const void* 初始化內部指標
|
|
| Pointer (void *pointer) |
| 建立一個 Pointer 物件,並以 void* 初始化內部指標
|
|
| Pointer (uint32 pointer) |
| 建立一個 Pointer 物件,並以 32 位元整數表示的位址初始化
|
|
| Pointer (const Pointer &other) |
| 複製建構子,從另一個 Pointer 物件複製內部位址
|
|
virtual | ~Pointer (void) override |
| 解構子,釋放 Pointer 物件
|
|
| operator void * (void) |
| 隱式轉換為 void*,可直接取得內部指標
|
|
| operator const char * (void) |
| 隱式轉換為 const char*,適用於字串存取
|
|
bool | operator== (const void *pointer) |
| 比較內部指標與外部指標是否相同
|
|
bool | operator== (const Pointer &pointer) |
| 比較兩個 Pointer 物件的內部指標是否相同
|
|
template<typename E > |
| operator E* (void) |
| 模板運算子,將內部指標轉換為指定型態的指標(非 const 版本)
|
|
template<typename E > |
| operator E* (void) const |
| 模板運算子,將內部指標轉換為指定型態的指標(const 版本)
|
|
int | copyTo (void *destination, int length) const |
| 複製內部資料至目標記憶體區塊
|
|
int | copyTo (void *destination, int start, int length) const |
| 複製內部資料至目標記憶體區塊,可指定來源起始位置
|
|
bool | compairStrings (const char *str) const |
| 比較內部資料與傳入字串是否相同(從起始位置開始比較)
|
|
bool | compairStrings (const char *str, int start) const |
| 比較內部資料與傳入字串是否相同,可指定來源資料起始位置
|
|
bool | compair (const void *source, int length) const |
| 比較內部資料與來源資料是否相等(從起始位置開始比較)
|
|
bool | compair (const void *source, int start, int length) const |
| 比較內部資料與來源資料是否相等,可指定來源資料的起始偏移
|
|
int | indexOf (char ch, int start, int limit) const |
| 在內部資料中查找指定字元 ch,回傳該字元的偏移位置
|
|
int | indexOfStrings (const char *str, int limit) const |
| 在內部資料中查找指定字串,回傳該字串的偏移位置(使用預設起始位置)
|
|
int | indexOfStrings (const char *str, int start, int limit) const |
| 在內部資料中查找指定字串,回傳該字串的偏移位置
|
|
int | copy (const void *source, int length) |
| 複製來源資料至內部資料區塊,使用預設偏移參數
|
|
int | copy (const void *source, int offset, int length) |
| 複製來源資料至內部資料區塊,可指定目標位址偏移
|
|
char | getByte (int shift) const |
| 取得指定偏移處的 byte 值
|
|
int | getInteger (int shift) const |
| 取得指定偏移處的整數值
|
|
short | getShort (int shift) const |
| 取得指定偏移處的 short 值
|
|
Pointer | getPointer (int offset) const |
| 以指定偏移建立新的 Pointer 物件
|
|
uint32 | getAddress (void) const |
| 取得內部記憶體位址的整數表示
|
|
bool | isAlignment32Bit (void) |
| 檢查內部位址是否 32 位元對齊
|
|
bool | isAlignment64Bit (void) |
| 檢查內部位址是否 64 位元對齊
|
|
bool | isNull (void) const |
| 檢查內部指標是否為空
|
|
template<typename E = void*> |
E * | pointer (void) const |
| 模板方法,取得內部指標並轉換為指定型態(不指定偏移)
|
|
template<typename E = void*> |
E * | pointer (int offset) const |
| 模板方法,取得內部指標並轉換為指定型態(指定偏移)
|
|
template<typename E = void*> |
E * | pointer (uint32 offset) const |
| 模板方法,取得內部指標並轉換為指定型態(指定偏移,使用 uint32 參數)
|
|
virtual int | copy (const void *source, int offset, int sourceOffset, int length) |
| 將來源資料複製至內部記憶體區塊,可指定來源與目標的起始偏移
|
|
virtual int | copyTo (void *destination, int offset, int destinationOffset, int length) const |
| 將內部資料複製到目標記憶體區塊,可指定來源與目標的起始偏移
|
|
virtual bool | compair (const void *source, int offset, int sourceOffset, int length) const |
| 比較內部資料與來源資料是否相等,可指定各自的起始偏移與比較長度
|
|
virtual int | indexOfData (const void *destination, int destinationLen, int start=0, int limit=0) const |
| 尋找指定 pattern 是否存在於內部資料中,並返回第一個符合條件的偏移量
|
|
virtual void | move (int head, int offset, int length) |
| 將來源位置的資料以中間緩衝區方式移動至新的位置
|
|
| Object (void) |
| Construct a new Object object.
|
|
virtual | ~Object (void) override |
| Destroy the Object object.
|
|
void * | operator new (size_t n) |
|
void * | operator new (size_t n, void *p) |
|
mframe::lang::Object & | getObject (void) override |
| 取得類Object
|
|
void | delay (int milliseconds) const |
| 函數 delay 等待內核滴答中指定的時間段。 對於1的值,系統等待直到下一個計時器滴答發生。 實際時間延遲最多可能比指定時間少一個計時器滴答聲,即在下一個系統滴答聲發生之前立即調用 osDelay(1),線程會立即重新安排。
|
|
bool | equals (Object *object) const |
| 函數 delay 等待內核滴答中指定的時間段。 對於1的值,系統等待直到下一個計時器滴答發生。 實際時間延遲最多可能比指定時間少一個計時器滴答聲,即在下一個系統滴答聲發生之前立即調用 osDelay(1),線程會立即重新安排。
|
|
bool | equals (Object &object) const |
| 函數 delay 等待內核滴答中指定的時間段。 對於1的值,系統等待直到下一個計時器滴答發生。 實際時間延遲最多可能比指定時間少一個計時器滴答聲,即在下一個系統滴答聲發生之前立即調用 osDelay(1),線程會立即重新安排。
|
|
void | wait (void) const |
| 導致當前線程等待,直到另一個線程調用此對象的notify()方法或notifyAll()方法,或指定的時間 已過。
|
|
bool | wait (int timeout) const |
| 導致當前線程等待,直到另一個線程調用此對象的 notify()方法或 notifyAll()方法,或其他一些線 程中斷當前線程,或一定量的實時時間。
|
|
bool | yield (void) const |
| 函數yield()將控制權傳遞給處於READY狀態且具有相同優先級的下一個線程。 如果在READY狀態下沒有其他優先級相同的線程,則當前線程繼續執行,不會發生線程切換。
|
|
int | lock (void) const |
| 核心鎖定,在調用unlock以前將不會進行執行緒切換
|
|
int | unlock (void) const |
| 核心解鎖。
|
|
mframe::sys::Thread * | currentThread (void) const |
| 取得當前的執行緒
|
|
virtual int | hashcode (void) const |
| 返回對象的哈希碼值。支持這種方法是為了散列表,如HashMap提供的那樣。
|
|
virtual | ~Interface (void)=default |
| Destroy the struct object.
|
|
Pointer 類別,提供記憶體位址存取、資料複製、資料比較與查找等基本功能。
使用說明:
- 可利用此類別包裝任意記憶體位址,並透過多型轉換操作符取得特定型別的指標。
- 內建的 copy、copyTo 與 move 方法可應用於二進位資料複製與移動,支援來源與目標記憶體區塊 重疊之情況。
- compair 與 indexOfData 可用於資料內容的比較與搜尋,方便進行字串比對或 pattern 搜尋。
範例:
const char* msg = "Hello, world!";
uint32 addr = ptr.getAddress();
if(ptr.compairStrings("Hello")) {
}
char buffer[20];
ptr.copyTo(buffer, 0, 0, 5);
Pointer 類別,提供記憶體位址存取、資料複製、資料比較與查找等基本功能。
Definition Pointer.h:56