RTC Forums
November 23, 2024, 10:07:15 PM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Help
Login
Register
RTC Forums
>
Subscription
>
Support
>
TrtcInfo using.. .
Pages: [
1
]
« previous
next »
Print
Author
Topic: TrtcInfo using.. . (Read 5018 times)
Theprasit
RTC License++
Posts: 42
TrtcInfo using.. .
«
on:
April 06, 2017, 05:35:11 PM »
Hi Danijel,
I have questions regarding of using TrtcInfo:
1. How to check type? (like TrtcRecord.CheckType('index', rtc_xxx)
2. How to check their child available or exist?
3. If I need to pass TrtcInfo as remote function parameter, what type of parameter to pass on?
Regards,
Theprasit
Logged
D.Tkalcec (RTC)
Administrator
Posts: 1881
Re: TrtcInfo using.. .
«
Reply #1 on:
April 06, 2017, 06:17:36 PM »
"TRtcInfo" class is a direct descendant of "TRtcRecord", which means that the same properties and methods you can find on "TRtcRecord" are also available on "TRtcInfo", but ... "TRtcInfo" should ONLY be used for LOCAL storage and NOT for sending data between a Client and a Server, because it provides additional properties and methods like "asObj", "asPtr" and "Child" which can be used to store local objects and pointers, but anything you store in these properties will NOT be serialized for sending nor will it be copied if you use the "copyOf" method.
So .... you can use the "Info" property (it is available on most RTC components) to store custom information, objects and pointers which you need to process events implemented for the component, like the name of a file when implementing file transfer, but you should NOT create TRtcInfo instances if you expect anything stored inside them to be sent with remote functions.
Best Regards,
Danijel Tkalcec
Logged
Theprasit
RTC License++
Posts: 42
Re: TrtcInfo using.. .
«
Reply #2 on:
April 07, 2017, 08:29:19 AM »
Hi Danijel,
That's clear to me why TrtcInfo is not has parameter type for sending. By the way, I tried to use TrtcInfo for local shared storage but didn't find how to check that "Child" is existing or not. How to check for existing "Child" in TrtcInfo structure?
Regards,
Theprasit
Logged
D.Tkalcec (RTC)
Administrator
Posts: 1881
Re: TrtcInfo using.. .
«
Reply #3 on:
April 07, 2017, 08:50:19 AM »
Because
Child[]
and
asObj[]
properties on the "TRtcInfo" class share the same internal structure for object storage, even if you are using the "TRtcInfo" instance with "AutoCreate:=TRUE" (in which case a new "Child" instance would be auto-created on first read access), you can use the
asObj[]
property to check if an object is currently stored in a "Child" or "asObj" property under a given name. For example, if
asObj['myname']
returns
NIL
, it means that there is currently no object stored in the
Child['myname']
or the
asObj['myname']
property.
By the way ... the "asPtr" property stores objects in a separate internal structure, from which objects will NOT be auto-freed, but the same principle applies there as well, which means that you can use asPtr['myname'] to check if a "pointer" to an object is currently stored in the asPtr['myname'] property.
Best Regards,
Danijel Tkalcec
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Dashboard
-----------------------------
=> General
=> 3rd-Party
=> Quick Start
-----------------------------
Subscription
-----------------------------
=> Support
Loading...