Skip to content

Commit

Permalink
Added test of using structures without creating them using 'new' first
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan1248 committed Mar 16, 2016
1 parent a8e5c83 commit e42479e
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
60 changes: 60 additions & 0 deletions src/dev/radams/tgcreator/AppStructuresOnStack.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright © 2012, United States Government, as represented by the
* Administrator of the National Aeronautics and Space Administration.
* All rights reserved.
*
* The NASA Tensegrity Robotics Toolkit (NTRT) v1 platform is licensed
* under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/

/**
* @file AppPrismModel.cpp
* @brief Contains the definition function main() for the Three strut
* tensegrity prism example application
* @author Ryan Adams
* $Id$
*/

// This application

// This library
#include "tgcreator/tgNode.h"
#include "tgcreator/tgNodes.h"
#include "tgcreator/tgPair.h"
#include "tgcreator/tgStructure.h"
// The C++ Standard Library
#include <iostream>

/**
* The entry point.
* @param[in] argc the number of command-line arguments
* @param[in] argv argv[0] is the executable name
* @return 0
*/
int main(int argc, char** argv)
{
std::cout << "AppStructuresOnStack" << std::endl;

// Demonstrating working with structures without using "new tgStructure()" (!)

tgStructure root;

tgStructure sub;
sub.addNode(1,2,3, "testing");
sub.addNode(4,5,6, "testing");

root.addChild(sub);
sub.move(btVector3(5,5,5));
root.addChild(sub); // Should add the moved version without altering the previously added sub

std::cout << root << std::endl;
}
4 changes: 4 additions & 0 deletions src/dev/radams/tgcreator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ include_directories(${INC_DIR})
add_executable(AppNestedStructureTest
AppNestedStructureTest.cpp
)

add_executable(AppStructuresOnStack
AppStructuresOnStack.cpp
)

0 comments on commit e42479e

Please sign in to comment.