Beispiel #1
0
    def do_example6c(self, value, delta):
        # Log the function entry
        self.log_function("example6c")

        # Take an vector array (in/out) then add a array to it (in)
        value._sarrayint2.set(
            0,
            value._sarrayint2.get(0) + delta._sarrayint2.get(0))
        value._sarrayint2.set(
            1,
            value._sarrayint2.get(1) + delta._sarrayint2.get(1))
        value._sarrayint2.set(
            2,
            value._sarrayint2.get(2) + delta._sarrayint2.get(2))

        # Output the origin reflection of it (out)
        reflection = FeaturePlugin._VectorInt()
        reflection._sarrayint2.set(0, -value._sarrayint2.get(0))
        reflection._sarrayint2.set(1, -value._sarrayint2.get(1))
        reflection._sarrayint2.set(2, -value._sarrayint2.get(2))

        # Return the sum of the reflection elements
        result = reflection._sarrayint2.get(0) + reflection._sarrayint2.get(
            1) + reflection._sarrayint2.get(2)

        return (result, value, reflection)
Beispiel #2
0
    def do_example2b(self):
        # Log the function entry
        self.log_function("example2b")

        # Initialize a complex number to (0, -i)
        complex_number = FeaturePlugin._ComplexNumber()
        complex_number.real = 0
        complex_number.imag = -1

        return (complex_number)
Beispiel #3
0
    def do_example2b(self):
        # Log the function entry
        self.log_function("example2b")

        # Initialize a complex number to (0, -i)
        complex_number = FeaturePlugin._ComplexNumber()
        complex_number.real = 0
        complex_number.imag = -1

        return complex_number
def test_feature_plugin_api_example2a(engine, info):
  # Create an instance of the FEATURE_PLUGIN_API class
  extension = engine.create_extension(info, FeaturePlugin.Api, None)

  # Initialize the complex number for to (3, 4i), the modulus for this number is 5
  a = FeaturePlugin._ComplexNumber()
  a.real = 3
  a.imag = 4

  # Call the plugin function using the function pointer
  result = extension.example2a(a)
  g_assert_cmpint(result, "==", 5)
Beispiel #5
0
def test_feature_plugin_api_example2a(engine, info):
    # Create an instance of the FEATURE_PLUGIN_API class
    extension = engine.create_extension(info, FeaturePlugin.Api, None)

    # Initialize the complex number for to (3, 4i), the modulus for this number is 5
    a = FeaturePlugin._ComplexNumber()
    a.real = 3
    a.imag = 4

    # Call the plugin function using the function pointer
    result = extension.example2a(a)
    g_assert_cmpint(result, "==", 5)
Beispiel #6
0
    def do_example7b(self, value, delta):
        # Log the function entry
        self.log_function("example7b")

        # Take an vector array (in/out) then add a array to it (in)
        value._darrayint.set(0, value._darrayint.get(0) + delta._darrayint.get(0))
        value._darrayint.set(1, value._darrayint.get(1) + delta._darrayint.get(1))
        value._darrayint.set(2, value._darrayint.get(2) + delta._darrayint.get(2))

        # Output the origin reflection of it (out)
        reflection = FeaturePlugin._VectorInt()
        reflection._darrayint.set(0, -value._darrayint.get(0))
        reflection._darrayint.set(1, -value._darrayint.get(1))
        reflection._darrayint.set(2, -value._darrayint.get(2))

        # Return the sum of the reflection elements
        result = reflection._darrayint.get(0) + reflection._darrayint.get(1) + reflection._darrayint.get(2)

        return (result, value, reflection)