tmm_cache_entry_find()

注意: 需要地形建模模块(Terrain Modeling Module)功能。

摘要

判断 TmmT_Cache 数据结构中是否存在与指定位置匹配的条目,并返回该条目。

语法

tmm_cache_entry_find (cache_ptr, entry_key_ptr)
参数 类型 说明
cache_ptr TmmT_Loss_Cache* 指向要搜索的缓存的指针。
entry_key_ptr TmmT_Cache_Entry * 指向用户创建的、包含要在缓存中查找的位置的条目的指针。

返回类型

Boolean

若找到与指定位置匹配的条目则返回 OPC_TRUE,并将 entry_key_ptr 指向的数据结构中的 loss_value、value_status 和 msg_v[] 值更改为匹配缓存条目中的值。若未找到匹配,返回 OPC_FALSE。

头文件

tmm.h

示例

TmmT_Cache_Entry    loss_entry;

/* prepare the key used to search the cache with */
/* our Tx/Rx positions and heights               */
loss_entry.tx_quantized_position = *tx_pos_ptr;
loss_entry.rx_quantized_position = *rx_pos_ptr;

/* Search cache for a value that has already been computed */
if (tmm_cache_entry_find (cache_ptr, &loss_entry) == OPC_FALSE)
    {
    /* Do work needed to calculate the loss */
    ...
    }
else
    {
    /* A value was found in the cache. */
    /* _find fills the "loss_entry" structure with values */
    *status_ptr = loss_entry.value_status;
    }

FRET (loss_cache_entry.loss_value)

详情

为了限制仿真期间路径损耗的计算次数,会创建一个数据结构(缓存),其中包含发射与接收天线对的所有先前位置。如果天线可移动并在传输之间移动,则在缓存中查找新位置。如果存在匹配,应用程序使用缓存中存储的对应天线位置的路径损耗,而不是重新计算路径损耗。

要发生匹配,每个新位置必须接近某个缓存条目中的位置。需要"接近"到什么程度,由使用 tmm_cache_create() 创建缓存时指定的位置和高度容差决定。

要查找的位置应位于类型为 TmmT_Cache_Entry 的数据结构中。该结构的内容与单个缓存条目相同,如 tmm_cache_create() 的详情小节所示。如果找到匹配,本函数会将找到的 loss_value 和 value_status 值放入调用中指定的数据结构。

用途

本函数用于搜索指定缓存,以确定是否已为指定位置先前计算过路径损耗。若是,则返回该路径损耗。

错误

  • 缓存参数无效。检查你的缓存尚未被传递给 tmm_cache_destroy()。
  • 指向 Entry 键数据结构的指针为 NULL。你应当使用一个缓存和一个 TmmT_Cache_Entry 的地址来调用 tmm_cache_entry_find()。

参考

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · Documentation compiled and provided by Beijing ZNetLink Technology Co., Ltd.

交流群 · QQ Group:OPNET/智网妙算网络仿真交流群(群号 486383494)

原文档 © 2017 Riverbed Technology · 本站为公益翻译,由 AI 辅助完成,请仔细甄别

Original documentation © 2017 Riverbed Technology. Community translation, AI-assisted. Contact: jiazequn@znetlink.com