<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Usage of existing elements created by someone else]]></title><description><![CDATA[<p dir="auto">Hello!</p>
<p dir="auto">Can we use in the state updater element functionality of existing SAMSON elements?</p>
<p dir="auto">We want to use in our element functionality of TWISTER element. Is it possible somehow specify in our code control points for Twister and move points to twist molecule?</p>
<p dir="auto">Thanks</p>
]]></description><link>https://forum.samson-connect.net/topic/63/usage-of-existing-elements-created-by-someone-else</link><generator>RSS for Node</generator><lastBuildDate>Sun, 13 Sep 2026 02:33:59 GMT</lastBuildDate><atom:link href="https://forum.samson-connect.net/topic/63.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 31 Oct 2018 07:40:47 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Usage of existing elements created by someone else on Wed, 07 Nov 2018 10:43:36 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/andrii" aria-label="Profile: Andrii">@<bdi>Andrii</bdi></a> It can be done from the code. For now, we do not have docs/help web-pages for each of the SAMSON Elements, but it is in our plans to have them generated automatically for the exposed functionality.</p>
<p dir="auto">To get UUID and the class name of an Element from which you want to use functionality, you can open the Log (<strong>Edit menu -&gt; Show log</strong>), then you can search for the Element and check its UUID and the class name:<br />
<img src="/assets/uploads/files/1541585623288-logviewer-checkuuidandnameofsamsonelement-resized.png" alt="0_1541585623122_LogViewer-CheckUUIDAndNameOfSAMSONElement.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Now, in your code, you can do the following to print the exposed functionality of the Element:</p>
<pre><code>// Create a class proxy
SBProxy* classProxy = SAMSON::getProxy("PDBDownload", SBUUID("6F5D45C5-E76E-CDC8-52D5-D2821C128BE8"));
// Print class constructors
classProxy-&gt;print();
// Prints the interface
classProxy-&gt;getInterface()-&gt;print();
</code></pre>
<p dir="auto">It will print the exposed functionality (constructor factory, interface functions, attributes) in the terminal (std::cout stream), like this:</p>
<pre><code>Class proxy:
	Name	:PDBDownload
	UUID	:23E5619D-CF88-CD8D-C516-725286102AF8
	Element	:PDBDownload
	Type	:10
	Factory: 
		PDBDownload()

	Interface:
		download(std::string, std::string)
		downloadPdb(std::string)
		downloadPdb1(std::string)

	Attributes:
</code></pre>
<p dir="auto">You might need to allow the terminal with "--logconsole" flag when running SAMSON.</p>
<p dir="auto">If you have some problems with std::cout not printing to your terminal, you might print it yourself into std::cerr:</p>
<pre><code>// Print interface
std::cerr &lt;&lt; "Interface:\n";
auto functionMap = classProxy-&gt;getInterface()-&gt;getFunctionMap();
for (auto i = functionMap.begin(); i != functionMap.end(); ++i)
	std::cerr &lt;&lt; i-&gt;getKey() &lt;&lt; "\n";

// Print attributes
std::cerr &lt;&lt; "Attributes:\n";
auto attributeMap = classProxy-&gt;getInterface()-&gt;getAttributeMap();
for (auto i = attributeMap.begin(); i != attributeMap.end(); ++i)
	std::cerr &lt;&lt; i-&gt;getKey() &lt;&lt; "\n";
</code></pre>
]]></description><link>https://forum.samson-connect.net/post/212</link><guid isPermaLink="true">https://forum.samson-connect.net/post/212</guid><dc:creator><![CDATA[DmitriyMarin]]></dc:creator><pubDate>Wed, 07 Nov 2018 10:43:36 GMT</pubDate></item><item><title><![CDATA[Reply to Usage of existing elements created by someone else on Wed, 07 Nov 2018 09:06:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dmitriy" aria-label="Profile: DMITRIY">@<bdi>DMITRIY</bdi></a> MARIN, thank you!</p>
<p dir="auto">Could you please advise how find exposed functionality of existing SAMSON Elements?</p>
<p dir="auto">Thanks again</p>
]]></description><link>https://forum.samson-connect.net/post/211</link><guid isPermaLink="true">https://forum.samson-connect.net/post/211</guid><dc:creator><![CDATA[Andrii]]></dc:creator><pubDate>Wed, 07 Nov 2018 09:06:49 GMT</pubDate></item><item><title><![CDATA[Reply to Usage of existing elements created by someone else on Wed, 31 Oct 2018 10:07:13 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/andrii" aria-label="Profile: Andrii">@<bdi>Andrii</bdi></a></p>
<p dir="auto">Brief answers to the two questions: 1) Yes; 2) No, not for now.</p>
<p dir="auto"><strong>The answer to the 1st question.</strong> Yes, you <strong>can</strong> use the functionality of existing SAMSON Elements in your Element, but only the functionality which is exposed. Please, check <a href="https://documentation.samson-connect.net/developers/latest/page_introspection.html" rel="nofollow ugc">SAMSON Introspection mechanism</a> (note, that some parts of the introspection functionality described in the documentation have been updated and not yet modified in the documentation).</p>
<p dir="auto">Let's say you want to use the functionality of a class called <em>SEMyClass</em> from the SAMSON Element with UUID <em>554FEFC0-CF52-A7EC-BEBB-3230C5705738</em>. It can be done like this:</p>
<pre><code>// Create a class proxy
SBProxy* classProxy = SAMSON::getProxy("SEMyClass", SBUUID("554FEFC0-CF52-A7EC-BEBB-3230C5705738"));
// Create an instance of the class
SBValue objectHolder = classProxy-&gt;createInstance();
</code></pre>
<p dir="auto">Now you can use the exposed functionality of this class. Let's say the exposed class has an exposed function called <em>multiply</em> which multiplies two arguments. This function can be called like this:</p>
<pre><code>SBValue resultHolder = classProxy-&gt;call(objectHolder, "multiply", 10.0, 3.14);
double result = SB_CAST&lt;double&gt;(resultHolder);
</code></pre>
<p dir="auto"><strong>The answer to the 2nd question</strong>. For now, it is not possible to use the <strong>Twister</strong> functionality in the code, because its functionality is not exposed. It might be updated in the next version.</p>
]]></description><link>https://forum.samson-connect.net/post/208</link><guid isPermaLink="true">https://forum.samson-connect.net/post/208</guid><dc:creator><![CDATA[DmitriyMarin]]></dc:creator><pubDate>Wed, 31 Oct 2018 10:07:13 GMT</pubDate></item></channel></rss>