text:
namespace gpu {

class SyncPointManagerTest : public testing::Test {
 public:
  SyncPointManagerTest() : sync_point_manager_(new SyncPointManager) {}
  ~SyncPointManagerTest() override = default;

 protected:
  // Simple static function which can be used to test callbacks.
  static void SetIntegerFunction(int* test, int value) { *test = value; }

  std::unique_ptr<SyncPointManager> sync_point_manager_;
};

struct SyncPointStream {
  scoped_refptr<SyncPointOrderData> order_data;
  scoped_refptr<SyncPointClientState> client_state;
  base::queue<uint32_t> order_numbers;

  SyncPointStream(SyncPointManager* sync_point_manager,
                  CommandBufferNamespace namespace_id,
                  CommandBufferId command_buffer_id)
      : order_data(sync_point_manager->CreateSyncPointOrderData()),
        client_state(sync_point_manager->CreateSyncPointClientState(
            namespace_id,
            command_buffer_id,
            order_data->sequence_id())) {}

  ~SyncPointStream() {
    if (order_data)
      order_data->Destroy();
    if (client_state)
      client_state->Destroy();
  }

  void AllocateOrderNum() {
    order_numbers.push(order_data->GenerateUnprocessedOrderNumber());
  }

  void BeginProcessing() {
    ASSERT_FALSE(order_numbers.empty());
    order_data->BeginProcessingOrderNumber(order_numbers.front());
  }

  void EndProcessing() {
    ASSERT_FALSE(order_numbers.empty());
    order_data->FinishProcessingOrderNumber(order_numbers.front());
    order_numbers.pop();
  }
};

TEST_F(SyncPointManagerTest, BasicSyncPointOrderDataTest) {
  scoped_refptr<SyncPointOrderData> order_data =
      sync_point_manager_->CreateSyncPointOrderData();

  EXPECT_EQ(0u, order_data->current_order_num());
  EXPECT_EQ(0u, order_data->processed_order_num());
  EXPECT_EQ(0u, order_data->unprocessed_order_num());

  uint32_t order_num = order_data->GenerateUnprocessedOrderNumber();
  EXPECT_EQ(1u, order_num);

  EXPECT_EQ(0u, order_data->current_order_num());
  EXPECT_EQ(0u, order_data->processed_order_num());
  EXPECT_EQ(order_num, order_data->unprocessed_order_num());

  order_data->BeginProcessingOrderNumber(order_num);
  EXPECT_EQ(order_num, order_data->current_order_num());
  EXPECT_EQ(0u, order_data->processed_order_num());
  EXPECT_EQ(order_num, order_data->unprocessed_order_num());
  EXPECT_TRUE(order_data->IsProcessingOrderNumber());

  order_data->PauseProcessingOrderNumber(order_num);
  EXPECT_FALSE(order_data->IsProcessingOrderNumber());

  order_data->BeginProcessingOrderNumber(order_num);
  EXPECT_TRUE(order_data->IsProcessingOrderNumber());

  order_data->FinishProcessingOrderNumber(order_num);
  EXPECT_EQ(order_num, order_data->current_order_num());
  EXPECT_EQ(order_num, order_data->processed_order_num());
  EXPECT_EQ(order_num, order_data->unprocessed_order_num());
  EXPECT_FALSE(order_data->IsProcessingOrderNumber());

  order_data->Destroy();
}

TEST_F(SyncPointManagerTest, BasicFenceSyncRelease) {
  CommandBufferNamespace kNamespaceId = gpu::CommandBufferNamespace::GPU_IO;
  CommandBufferId kBufferId = CommandBufferId::FromUnsafeValue(0x123);

  uint64_t release_count = 1;
  SyncToken sync_token(kNamespaceId, kBufferId, release_count);

  // Can't wait for sync token before client is registered.
  EXPECT_TRUE(sync_point_manager_->IsSyncTokenReleased(sync_token));

  SyncPointStream stream(sync_point_manager_.get(), kNamespaceId, kBufferId);

  stream.AllocateOrderNum();

  EXPECT_FALSE(sync_point_manager_->IsSyncTokenReleased(sync_token));

  stream.order_data->BeginProcessingOrderNumber(1);
  stream.client_state->ReleaseFenceSync(release_count);
  stream.order_data->FinishProcessingOrderNumber(1);

  EXPECT_TRUE(sync_point_manager_->IsSyncTokenReleased(sync_token));
}

TEST_F(SyncPointManagerTest, OutOfOrderSyncTokenRelease) {
  CommandBufferNamespace kNamespaceId = gpu::CommandBufferNamespace::GPU_IO;
  CommandBufferId kBufferId = CommandBufferId::FromUnsafeValue(0x123);

  uint64_t release_count_1 = 2;
  SyncToken sync_token_1(kNamespaceId, kBufferId, release_count_1);
  uint64_t release_count_2 = 1;
  SyncToken sync_token_2(kNamespaceId, kBufferId, release_count_2);

  SyncPointStream stream(sync_point_manager_.get(), kNamespaceId, kBufferId);
  stream.AllocateOrderNum();
  stream.AllocateOrderNum();

  EXPECT_FALSE(sync_point_manager_->IsSyncTokenReleased(sync_token_1));
  EXPECT_FALSE(sync_point_manager_->IsSyncTokenReleased(sync_token_2));

  // Releasing the first sync token also releases the second because the first
  // token's release count is larger.
  stream.order_data->BeginProcessingOrderNumber(1);
  stream.client_state->ReleaseFenceSync(release_count_1);
  stream.order_data->FinishProcessingOrderNumber(1);
  EXPECT_TRUE(sync_point_manager_->IsSyncTokenReleased(sync_token_1));
  EXPECT_TRUE(sync_point_manager_->IsSyncTokenReleased(sync_token_2));

  // Releasing the second token should be a no-op.
  stream.order_data->BeginProcessingOrderNumber(2);
  stream.client_state->ReleaseFenceSync(release_count_2);
  stream.order_data->FinishProcessingOrderNumber(2);
  EXPECT_TRUE(sync_point_manager_->IsSyncTokenReleased(sync_token_1));
  EXPECT_TRUE(sync_point_manager_->IsSyncTokenReleased(sync_token_2));
}

TEST_F(SyncPointManagerTest, MultipleClientsPerOrderData) {
  CommandBufferNamespace kNamespaceId = gpu::CommandBufferNamespace::GPU_IO;
  CommandBufferId kCmdBufferId1 = CommandBufferId::FromUnsafeValue(0x123);
  CommandBufferId kCmdBufferId2 = CommandBufferId::FromUnsafeValue(0x234);

  SyncPointStream stream1(sync_point_manager_.get(), kNamespaceId,
                          kCmdBufferId1);
  SyncPointStream stream2(sync_point_manager_.get(), kNamespaceId,
                          kCmdBufferId2);

  uint64_t release_count = 1;
  SyncToken sync_token1(kNamespaceId, kCmdBufferId1, release_count);
  stream1.AllocateOrderNum();

  SyncToken sync_token2(kNamespaceId, kCmdBufferId2, release_count);
  stream2.AllocateOrderNum();

  EXPECT_FALSE(sync_point_manager_->IsSyncTokenReleased(sync_token1));
  EXPECT_FALSE(sync_point_manager_->IsSyncTokenReleased(sync_token2));

  stream1.order_data->BeginProcessingOrderNumber(1);
  stream1.client_state->ReleaseFenceSync(release_count);
  stream1.order_data->FinishProcessingOrderNumber(1);

  EXPECT_TRUE(sync_point_manager_->IsSyncTokenReleased(sync_token1));
  EXPECT_FALSE(sync_point_manager_->IsSyncTokenReleased(sync_token2));
}

TEST_F(SyncPointManagerTest, BasicFenceSyncWaitRelease) {
  CommandBufferNamespace kNamespaceId = gpu::CommandBufferNamespace::GPU_IO;
  CommandBufferId kReleaseCmdBufferId = CommandBufferId::FromUnsafeValue(0x123);
  CommandBufferId kWaitCmdBufferId = CommandBufferId::FromUnsafeValue(0x234);

  SyncPointStream release_stream(sync_point_manager_.get(), kNamespaceId,
                                 kReleaseCmdBufferId);
  SyncPointStream wait_stream(sync_point_manager_.get(), kNamespaceId,
                              kWaitCmdBufferId);

  release_stream.AllocateOrderNum();
  wait_stream.AllocateOrderNum();

  uint64_t release_count = 1;
  SyncToken sync_token(kNamespaceId, kReleaseCmdBufferId, release_count);

  wait_stream.BeginProcessing();
  int test_num = 10;
  bool valid_wait = wait_stream.client_state->Wait(
      sync_token, base::BindOnce(&SyncPointManagerTest::SetIntegerFunction,
                                 &test_num, 123));
  EXPECT_TRUE(valid_wait);
  EXPECT_EQ(10, test_num);
  EXPECT_FALSE(sync_point_manager_->IsSyncTokenReleased(sync_token));

  release_stream.BeginProcessing();
  release_stream.client_state->ReleaseFenceSync(release_count);
  EXPECT_EQ(123, test_num);
  EXPECT_TRUE(sync_point_manager_->IsSyncTokenReleased(sync_token));
}

TEST_F(SyncPointManagerTest, WaitWithOutOfOrderSyncTokenRelease) {
  CommandBufferNamespace kNamespaceId = gpu::CommandBufferNamespace::GPU_IO;
  CommandBufferId kReleaseCmdBufferId = CommandBufferId::FromUnsafeValue(0x123);
  CommandBufferId kWaitCmdBufferId = CommandBufferId::FromUnsafeValue(0x234);

  int test_num_1 = 10;
  int test_num_2 = 10;
  int test_num_3 = 10;
  SyncPointStream release_stream(sync_point_manager_.get(), kNamespaceId,
                                 kReleaseCmdBufferId);
  SyncPointStream wait_stream(sync_point_manager_.get(), kNamespaceId,
                              kWaitCmdBufferId);

  release_stream.AllocateOrderNum();
  uint64_t release_count_1 = 2;
  SyncToken sync_token_1(kNamespaceId, kReleaseCmdBufferId, release_count_1);
  release_stream.AllocateOrderNum();
  uint64_t release_count_2 = 1;
  SyncToken sync_token_2(kNamespaceId, kReleaseCmdBufferId, release_count_2);
  release_stream.AllocateOrderNum();
  uint64_t release_count_3 = 3;
  SyncToken sync_token_3(kNamespaceId, kReleaseCmdBufferId, release_count_3);

  wait_stream.AllocateOrderNum();
  wait_stream.BeginProcessing();
  bool valid_wait = wait_stream.client_state->Wait(
      sync_token_1, base::BindOnce(&SyncPointManagerTest::SetIntegerFunction,
                                   &test_num_1, 123));
  EXPECT_TRUE(valid_wait);
  EXPECT_EQ(10, test_num_1);
  EXPECT_FALSE(sync_point_manager_->IsSyncTokenReleased(sync_token_1));
  wait_stream.EndProcessing();

  wait_stream.AllocateOrderNum();
  wait_stream.BeginProcessing();
  valid_wait = wait_stream.client_state->Wait(
      sync_token_2, base::BindOnce(&SyncPointManagerTest::SetIntegerFunction,
                                   &test_num_2, 123));
  EXPECT_TRUE(valid_wait);
  EXPECT_EQ(10, test_num_2);
  EXPECT_FALSE(sync_point_manager_->IsSyncTokenReleased(sync_token_2));
  wait_stream.EndProcessing();

  wait_stream.AllocateOrderNum();
  wait_stream.BeginProcessing();
  valid_wait = wait_stream.client_state->Wait(
      sync_token_3, base::BindOnce(&SyncPointManagerTest::SetIntegerFunction,
                                   &test_num_3, 123));
  EXPECT_TRUE(valid_wait);
  EXPECT_EQ(10, test_num_3);
  EXPECT_FALSE(sync_point_manager_->IsSyncTokenReleased(sync_token_3));
  wait_stream.EndProcessing();

  // Releasing the first sync token should release the second one. Then,
  // releasing the second one should be a no-op.
  release_stream.BeginProcessing();
  release_stream.client_state->ReleaseFenceSync(release_count_1);
  EXPECT_EQ(123, test_num_1);
  EXPECT_EQ(123, test_num_2);
  EXPECT_EQ(10, test_num_3);
  EXPECT_TRUE(sync_point_manager_->IsSyncTokenReleased(sync_token_1));
  EXPECT_TRUE(sync_point_manager_->IsSyncTokenReleased(sync_token_2));
  EXPECT_FALSE(sync_point_manager_->IsSyncTokenReleased(sync_token_3));
  release_stream.EndProcessing();

  release_stream.BeginProcessing();
  release_stream.client_state->ReleaseFenceSync(release_count_2);
  EXPECT_EQ(123, test_num_1);
  EXPECT_EQ(123, test_num_2);
  EXPECT_EQ(10, test_num_3);
  EXPECT_TRUE(sync_point_manager_->IsSyncTokenReleased(sync_token_1));
  EXPECT_TRUE(sync_point_manager_->IsSyncTokenReleased(sync_token_2));
  EXPECT_FALSE(sync_point_manager_->IsSyncTokenReleased(sync_token_3));
  release_stream.EndProcessing();
}

TEST_F(SyncPointManagerTest, WaitOnSelfFails) {
  CommandBufferNamespace kNamespaceId = gpu::CommandBufferNamespace::GPU_IO;
  CommandBufferId kReleaseCmdBufferId = CommandBufferId::FromUnsafeValue(0x123);
  CommandBufferId kWaitCmdBufferId = CommandBufferId::FromUnsafeValue(0x234);

  SyncPointStream release_stream(sync_point_manager_.get(), kNamespaceId,
                                 kReleaseCmdBufferId);
  SyncPointStream wait_stream(sync_point_manager_.get(), kNamespaceId,
                              kWaitCmdBufferId);

  release_stream.AllocateOrderNum();
  wait_stream.AllocateOrderNum();

  uint64_t release_count = 1;
  SyncToken sync_token(kNamespaceId, kWaitCmdBufferId, release_count);

  wait_stream.BeginProcessing();
  int test_num = 10;
  bool valid_wait = wait_stream.client_state->Wait(
      sync_token, base::BindOnce(&SyncPointManagerTest::SetIntegerFunction,
                                 &test_num, 123));
  EXPECT_FALSE(valid_wait);
  EXPECT_EQ(10, test_num);
  EXPECT_FALSE(sync_point_manager_->IsSyncTokenReleased(sync_token));
}

TEST_F(SyncPointManagerTest, ReleaseAfterWaitOrderNumber) {
  CommandBufferNamespace kNamespaceId = gpu::CommandBufferNamespace::GPU_IO;
  CommandBufferId kReleaseCmdBufferId = CommandBufferId::FromUnsafeValue(0x123);
  CommandBufferId kWaitCmdBufferId = CommandBufferId::FromUnsafeValue(0x234);

  SyncPointStream release_stream(sync_point_manager_.get(), kNamespaceId,
                                 kReleaseCmdBufferId);
  SyncPointStream wait_stream(sync_point_manager_.get(), kNamespaceId,
                              kWaitCmdBufferId);

  // Generate wait order number first.
  wait_stream.AllocateOrderNum();
  release_stream.AllocateOrderNum();

  uint64_t release_count = 1;
  SyncToken sync_token(kNamespaceId, kReleaseCmdBufferId, release_count);

  wait_stream.BeginProcessing();
  int test_num = 10;
  bool valid_wait = wait_stream.client_state->Wait(
      sync_token, base::BindOnce(&SyncPointManagerTest::SetIntegerFunction,
                                 &test_num, 123));
  EXPECT_FALSE(valid_wait);
  EXPECT_EQ(10, test_num);
  EXPECT_FALSE(sync_point_manager_->IsSyncTokenReleased(sync_token));
}

TEST_F(SyncPointManagerTest, HigherOrderNumberRelease) {
  CommandBufferNamespace kNamespaceId = gpu::CommandBufferNamespace::GPU_IO;
  CommandBufferId kReleaseCmdBufferId = CommandBufferId::FromUnsafeValue(0x123);
  CommandBufferId kWaitCmdBufferId = CommandBufferId::FromUnsafeValue(0x234);

  SyncPointStream release_stream(sync_point_manager_.get(), kNamespaceId,
                                 kReleaseCmdBufferId);
  SyncPointStream wait_stream(sync_point_manager_.get(), kNamespaceId,
                              kWaitCmdBufferId);

  // Generate wait order number first.
  wait_stream.AllocateOrderNum();
  release_stream.AllocateOrderNum();

  uint64_t release_count = 1;
  SyncToken sync_token(kNamespaceId, kReleaseCmdBufferId, release_count);

  // Order number was higher but it was actually released.
  release_stream.BeginProcessing();
  release_stream.client_state->ReleaseFenceSync(release_count);
  release_stream.EndProcessing();

  // Release stream has already released so there's no need to wait.
  wait_stream.BeginProcessing();
  int test_num = 10;
  bool valid_wait = wait_stream.client_state->Wait(
      sync_token, base::BindOnce(&SyncPointManagerTest::SetIntegerFunction,
                                 &test_num, 123));
  EXPECT_FALSE(valid_wait);
  EXPECT_EQ(10, test_num);
  EXPECT_TRUE(sync_point_manager_->IsSyncTokenReleased(sync_token));
}

TEST_F(SyncPointManagerTest, DestroyedClientRelease) {
  CommandBufferNamespace kNamespaceId = gpu::CommandBufferNamespace::GPU_IO;
  CommandBufferId kReleaseCmdBufferId = CommandBufferId::FromUnsafeValue(0x123);
  CommandBufferId kWaitCmdBufferId = CommandBufferId::FromUnsafeValue(0x234);

  SyncPointStream release_stream(sync_point_manager_.get(), kNamespaceId,
                                 kReleaseCmdBufferId);
  SyncPointStream wait_stream(sync_point_manager_.get(), kNamespaceId,
                              kWaitCmdBufferId);

  release_stream.AllocateOrderNum();
  wait_stream.AllocateOrderNum();

  uint64_t release_count = 1;
  SyncToken sync_token(kNamespaceId, kReleaseCmdBufferId, release_count);

  wait_stream.BeginProcessing();

  int test_num = 10;
  bool valid_wait = wait_stream.client_state->Wait(
      sync_token, base::BindOnce(&SyncPointManagerTest::SetIntegerFunction,
                                 &test_num, 123));
  EXPECT_TRUE(valid_wait);
  EXPECT_EQ(10, test_num);

  // Destroying the client should release the wait.
  release_stream.client_state->Destroy();
  release_stream.client_state = nullptr;

  EXPECT_EQ(123, test_num);
  EXPECT_TRUE(sync_point_manager_->IsSyncTokenReleased(sync_token));
}

TEST_F(SyncPointManagerTest, NonExistentRelease) {
  CommandBufferNamespace kNamespaceId = gpu::CommandBufferNamespace::GPU_IO;
  CommandBufferId kReleaseCmdBufferId = CommandBufferId::FromUnsafeValue(0x123);
  CommandBufferId kWaitCmdBufferId = CommandBufferId::FromUnsafeValue(0x234);

  SyncPointStream release_stream(sync_point_manager_.get(), kNamespaceId,
                                 kReleaseCmdBufferId);
  SyncPointStream wait_stream(sync_point_manager_.get(), kNamespaceId,
                              kWaitCmdBufferId);

  // Assign release stream order [1] and wait stream order [2].
  // This test simply tests that a wait stream of order [2] waiting on
  // release stream of order [1] will still release the fence sync even
  // though nothing was released.
  release_stream.AllocateOrderNum();
  wait_stream.AllocateOrderNum();

  uint64_t release_count = 1;
  SyncToken sync_token(kNamespaceId, kReleaseCmdBufferId, release_count);

  wait_stream.BeginProcessing();
  int test_num = 10;
  bool valid_wait = wait_stream.client_state->Wait(
      sync_token, base::BindOnce(&SyncPointManagerTest::SetIntegerFunction,
                                 &test_num, 123));
  EXPECT_TRUE(valid_wait);
  EXPECT_EQ(10, test_num);
  EXPECT_FALSE(sync_point_manager_->IsSyncTokenReleased(sync_token));

  // No release but finishing the order number should automatically release.
  release_stream.BeginProcessing();
  EXPECT_EQ(10, test_num);
  release_stream.EndProcessing();
  EXPECT_EQ(123, test_num);
  EXPECT_FALSE(sync_point_manager_->IsSyncTokenReleased(sync_token));
}

TEST_F(SyncPointManagerTest, NonExistentRelease2) {
  CommandBufferNamespace kNamespaceId = gpu::CommandBufferNamespace::GPU_IO;
  CommandBufferId kReleaseCmdBufferId = CommandBufferId::FromUnsafeValue(0x123);
  CommandBufferId kWaitCmdBufferId = CommandBufferId::FromUnsafeValue(0x234);

  SyncPointStream release_stream(sync_point_manager_.get(), kNamespaceId,
                                 kReleaseCmdBufferId);
  SyncPointStream wait_stream(sync_point_manager_.get(), kNamespaceId,
                              kWaitCmdBufferId);

  // Assign Release stream order [1] and assign Wait stream orders [2, 3].
  // This test is similar to the NonExistentRelease case except
  // we place an extra order number in between the release and wait.
  // The wait stream [3] is waiting on release stream [1] even though
  // order [2] was also generated. Although order [2] only exists on the
  // wait stream so the release stream should only know about order [1].
  release_stream.AllocateOrderNum();
  wait_stream.AllocateOrderNum();
  wait_stream.AllocateOrderNum();

  uint64_t release_count = 1;
  SyncToken sync_token(kNamespaceId, kReleaseCmdBufferId, release_count);

  EXPECT_FALSE(sync_point_manager_->IsSyncTokenReleased(sync_token));
  // Have wait with order [3] to wait on release.
  wait_stream.BeginProcessing();
  EXPECT_EQ(2u, wait_stream.order_data->current_order_num());
  wait_stream.EndProcessing();
  wait_stream.BeginProcessing();
  EXPECT_EQ(3u, wait_stream.order_data->current_order_num());
  int test_num = 10;
  bool valid_wait = wait_stream.client_state->Wait(
      sync_token, base::BindOnce(&SyncPointManagerTest::SetIntegerFunction,
                                 &test_num, 123));
  EXPECT_TRUE(valid_wait);
  EXPECT_EQ(10, test_num);
  EXPECT_FALSE(sync_point_manager_->IsSyncTokenReleased(sync_token));

  // Even though release stream order [1] did not have a release, it
  // should have changed test_num although the fence sync is still not released.
  release_stream.BeginProcessing();
  EXPECT_EQ(1u, release_stream.order_data->current_order_num());
  release_stream.EndProcessing();
  EXPECT_EQ(123, test_num);
  EXPECT_FALSE(sync_point_manager_->IsSyncTokenReleased(sync_token));

  // Ensure that the wait callback does not get triggered again when it is
  // actually released.
  test_num = 1;
  release_stream.AllocateOrderNum();
  release_stream.BeginProcessing();
  release_stream.client_state->ReleaseFenceSync(release_count);
  release_stream.EndProcessing();
  EXPECT_EQ(1, test_num);
  EXPECT_TRUE(sync_point_manager_->IsSyncTokenReleased(sync_token));
}

TEST_F(SyncPointManagerTest, NonExistentOrderNumRelease) {
  CommandBufferNamespace kNamespaceId = gpu::CommandBufferNamespace::GPU_IO;
  CommandBufferId kReleaseCmdBufferId = CommandBufferId::FromUnsafeValue(0x123);
  CommandBufferId kWaitCmdBufferId = CommandBufferId::FromUnsafeValue(0x234);

  SyncPointStream release_stream(sync_point_manager_.get(), kNamespaceId,
                                 kReleaseCmdBufferId);
  SyncPointStream wait_stream(sync_point_manager_.get(), kNamespaceId,
                              kWaitCmdBufferId);

  // Assign Release stream orders [1, 4] and assign Wait stream orders [2, 3].
  // Here we are testing that wait order [3] will wait on a fence sync
  // in either order [1] or order [2]. Order [2] was not actually assigned
  // to the release stream so it is essentially non-existent to the release
  // stream's point of view. Once the release stream begins processing the next
  // order [3], it should realize order [2] didn't exist and release the fence.
  release_stream.AllocateOrderNum();
  wait_stream.AllocateOrderNum();
  wait_stream.AllocateOrderNum();
  release_stream.AllocateOrderNum();

  uint64_t release_count = 1;
  SyncToken sync_token(kNamespaceId, kReleaseCmdBufferId, release_count);

  // Have wait with order [3] to wait on release order [1] or [2].
  wait_stream.BeginProcessing();
  EXPECT_EQ(2u, wait_stream.order_data->current_order_num());
  wait_stream.EndProcessing();
  wait_stream.BeginProcessing();
  EXPECT_EQ(3u, wait_stream.order_data->current_order_num());
  int test_num = 10;
  bool valid_wait = wait_stream.client_state->Wait(
      sync_token, base::BindOnce(&SyncPointManagerTest::SetIntegerFunction,
                                 &test_num, 123));
  EXPECT_TRUE(valid_wait);
  EXPECT_EQ(10, test_num);

  // Release stream should know it should release fence sync by order [3], but
  // it has no unprocessed order numbers less than 3, so it runs the callback.
  release_stream.BeginProcessing();
  EXPECT_EQ(1u, release_stream.order_data->current_order_num());
  release_stream.EndProcessing();
  EXPECT_FALSE(sync_point_manager_->IsSyncTokenReleased(sync_token));
  EXPECT_EQ(123, test_num);

  // Ensure that the wait callback does not get triggered again when it is
  // actually released.
  release_stream.BeginProcessing();
  test_num = 10;
  release_stream.client_state->ReleaseFenceSync(1);
  EXPECT_EQ(10, test_num);
  EXPECT_TRUE(sync_point_manager_->IsSyncTokenReleased(sync_token));
}

TEST_F(SyncPointManagerTest, WaitOnSameSequenceFails) {
  CommandBufferNamespace kNamespaceId = gpu::CommandBufferNamespace::GPU_IO;
  CommandBufferId kCmdBufferId = CommandBufferId::FromUnsafeValue(0x123);

  SyncPointStream stream(sync_point_manager_.get(), kNamespaceId, kCmdBufferId);

  // Dummy order number to avoid the wait_order_num <= processed_order_num + 1
  // check in SyncPointOrderData::ValidateReleaseOrderNum.
  sync_point_manager_->GenerateOrderNumber();

  // Order number for the wait.
  stream.AllocateOrderNum();

  uint64_t release_count = 1;
  SyncToken sync_token(kNamespaceId, kCmdBufferId, release_count);

  int test_num = 10;
  bool valid_wait = sync_point_manager_->Wait(
      sync_token, stream.order_data->sequence_id(),
      stream.order_data->unprocessed_order_num(),
      base::BindOnce(&SyncPointManagerTest::SetIntegerFunction, &test_num,
                     123));
  EXPECT_FALSE(valid_wait);
  EXPECT_EQ(10, test_num);
  EXPECT_FALSE(sync_point_manager_->IsSyncTokenReleased(sync_token));
}

TEST_F(SyncPointManagerTest, HandleInvalidWaitOrderNumber) {
  CommandBufferNamespace kNamespaceId = gpu::CommandBufferNamespace::GPU_IO;
  CommandBufferId kCmdBufferId1 = CommandBufferId::FromUnsafeValue(0x123);
  CommandBufferId kCmdBufferId2 = CommandBufferId::FromUnsafeValue(0x234);

  SyncPointStream stream1(sync_point_manager_.get(), kNamespaceId,
                          kCmdBufferId1);
  SyncPointStream stream2(sync_point_manager_.get(), kNamespaceId,
                          kCmdBufferId2);

  stream1.AllocateOrderNum();  // stream 1, order num 1
  stream2.AllocateOrderNum();  // stream 2, order num 2
  stream2.AllocateOrderNum();  // stream 2, order num 3
  stream1.AllocateOrderNum();  // stream 1, order num 4

  // Run stream 1, order num 1.
  stream1.BeginProcessing();
  stream1.EndProcessing();

  // Stream 2 waits on stream 1 with order num 3. This wait is invalid because
  // there's no unprocessed order num less than 3 on stream 1.
  int test_num = 10;
  bool valid_wait = sync_point_manager_->Wait(
      SyncToken(kNamespaceId, kCmdBufferId1, 1),
      stream2.order_data->sequence_id(), 3,
      base::BindOnce(&SyncPointManagerTest::SetIntegerFunction, &test_num,
                     123));
  EXPECT_FALSE(valid_wait);
  EXPECT_EQ(10, test_num);
}

TEST_F(SyncPointManagerTest, RetireInvalidWaitAfterOrderNumberPasses) {
  CommandBufferNamespace kNamespaceId = gpu::CommandBufferNamespace::GPU_IO;
  CommandBufferId kCmdBufferId1 = CommandBufferId::FromUnsafeValue(0x123);
  CommandBufferId kCmdBufferId2 = CommandBufferId::FromUnsafeValue(0x234);

  SyncPointStream stream1(sync_point_manager_.get(), kNamespaceId,
                          kCmdBufferId1);
  SyncPointStream stream2(sync_point_manager_.get(), kNamespaceId,
                          kCmdBufferId2);

  stream1.AllocateOrderNum();  // stream 1, order num 1
  stream1.AllocateOrderNum();  // stream 1, order num 2
  stream2.AllocateOrderNum();  // stream 2, order num 3

  // Stream 2 waits on stream 1 with order num 3.
  int test_num = 10;
  bool valid_wait = sync_point_manager_->Wait(
      SyncToken(kNamespaceId, kCmdBufferId1, 1),
      stream2.order_data->sequence_id(), 3,
      base::BindOnce(&SyncPointManagerTest::SetIntegerFunction, &test_num,
                     123));
  EXPECT_TRUE(valid_wait);
  EXPECT_EQ(10, test_num);

  stream1.AllocateOrderNum();  // stream 1, order num 4

  // Run stream 1, order num 1. The wait isn't retired.
  stream1.BeginProcessing();
  stream1.EndProcessing();
  EXPECT_EQ(10, test_num);

  // Run stream 1, order num 2. Wait is retired because we reach the last order
  // number that was unprocessed at the time the wait was enqueued.
  stream1.BeginProcessing();
  stream1.EndProcessing();
  EXPECT_EQ(123, test_num);
}

TEST_F(SyncPointManagerTest, HandleInvalidCyclicWaits) {
  CommandBufferNamespace kNamespaceId = gpu::CommandBufferNamespace::GPU_IO;
  CommandBufferId kCmdBufferId1 = CommandBufferId::FromUnsafeValue(0x123);
  CommandBufferId kCmdBufferId2 = CommandBufferId::FromUnsafeValue(0x234);

  SyncPointStream stream1(sync_point_manager_.get(), kNamespaceId,
                          kCmdBufferId1);
  SyncPointStream stream2(sync_point_manager_.get(), kNamespaceId,
                          kCmdBufferId2);

  stream1.AllocateOrderNum();  // stream 1, order num 1
  stream2.AllocateOrderNum();  // stream 2, order num 2
  stream1.AllocateOrderNum();  // stream 1, order num 3
  stream2.AllocateOrderNum();  // stream 2, order num 4

  // Stream 2 waits on stream 1 with order num 2.
  int test_num1 = 10;
  bool valid_wait = sync_point_manager_->Wait(
      SyncToken(kNamespaceId, kCmdBufferId1, 1),
      stream2.order_data->sequence_id(), 2,
      base::BindOnce(&SyncPointManagerTest::SetIntegerFunction, &test_num1,
                     123));
  EXPECT_TRUE(valid_wait);
  EXPECT_EQ(10, test_num1);

  // Stream 1 waits on stream 2 with order num 3.
  int test_num2 = 10;
  valid_wait = sync_point_manager_->Wait(
      SyncToken(kNamespaceId, kCmdBufferId2, 1),
      stream1.order_data->sequence_id(), 3,
      base::BindOnce(&SyncPointManagerTest::SetIntegerFunction, &test_num2,
                     123));
  EXPECT_TRUE(valid_wait);
  EXPECT_EQ(10, test_num2);

  // Run stream 1, order num 1.
  stream1.BeginProcessing();
  stream1.EndProcessing();

  // Since there's no unprocessed order num less than 2 on stream 1, the wait is
  // released.
  EXPECT_EQ(123, test_num1);
  EXPECT_EQ(10, test_num2);

  // Run stream 2, order num 2.
  stream2.BeginProcessing();
  stream2.EndProcessing();

  // Since there's no unprocessed order num less than 3 on stream 2, the wait is
  // released.
  EXPECT_EQ(123, test_num1);
  EXPECT_EQ(123, test_num2);
}

}  // namespace gpu


text:
require File.expand_path('../test_helper', __FILE__)

describe SimplePusher::Configuration do
  it 'must respond to debug method' do
    configuration = SimplePusher::Configuration.new
    configuration.debug.must_equal false # default to false
  end

  it 'must respond to port method' do
    configuration = SimplePusher::Configuration.new
    configuration.port.must_equal 8088 # default to 8088
  end

end

redpajama_set_name: RedPajamaGithub


text:
package org.wso2.andes.store;

import java.util.Collection;

import org.apache.log4j.Logger;
import org.wso2.andes.server.ClusterResourceHolder;

/**
 * A periodic task which will check weather  given {@link HealthAwareStore} is operational.
 *
 */
public class StoreHealthCheckTask implements Runnable {

    private static final Logger logger = Logger.getLogger(StoreHealthCheckTask.class);

    /**
     * the store which became in-operational. (therefore this task is checking
     * weather it becomes available again)
     */
    private HealthAwareStore store;

    /**
     * {@link StoreHealthListener}s which gets notified once the store becomes
     * operational.
     */
    private Collection<StoreHealthListener> healthListeners;

    /**
     * Instantiates a new task with a specified store and a list of listeners.
     * @param store in-operational store.
     * @param healthListeners listeners which this task needs to notify.
     */
    StoreHealthCheckTask(HealthAwareStore store, Collection<StoreHealthListener> healthListeners) {
        this.store = store;
        this.healthListeners = healthListeners;
    }

    /**
     * Checks periodically weather store is available.
     */
    @Override
    public void run() {

        String myNodeId = ClusterResourceHolder.getInstance().getClusterManager().getMyNodeID();

        logger.info(String.format("about to check store [%s]'s operational status ", store.getClass()));

        if (store.isOperational(myNodeId, System.currentTimeMillis())) {

            for (StoreHealthListener listener : healthListeners) {
                listener.storeOperational(store);
            }

        }
    }

}


text:
.sort-filter .modifiable-label {
	float:left;
	background-color: white;
	border: 1px solid #e3e3e3;
	padding:2px;
	padding-left:4px;
	margin-left: 3px;
}
.sort-filter .modifiable-label:first-child {
	margin-left: 0px;
}
.sort-filter .button.disabled {opacity:0.5;}

.sort-filter .filter-construct {
	background-color:white;
	border-color:white;
	border-width:2px;
	border-style:solid;
	padding:10px;
}
.sort-filter .filter-construct.chosen {border-color:lightblue;}
.sort-filter .filter-construct .controls .disable {opacity:0.5;}

.sort-filter .filter-construct .children {background-color:lightgrey;margin-bottom:10px;}

.sort-filter .filter-construct .children .filter-construct-child .filter-construct-child-inner {margin:5px;background-color:white;padding:5px;overflow:hidden;}
.sort-filter .filter-construct .children .filter-construct-child .filter-construct-child-inner.operator {text-align:center;}
.sort-filter .filter-construct .children .filter-construct-child.filter-constructs-item .filter-construct-child-inner {}

.sort-filter .filter-construct-dialogue {background-color:white;}


text:
/***************************************************************************//**
* \file CYBLE_HAL_PVT.c
* \version 3.20
*
* \brief
*  This file contains the source code for the HAL section of the BLE component
*
********************************************************************************
* \copyright
* Copyright 2014-2016, Cypress Semiconductor Corporation.  All rights reserved.
* You may use this file only in accordance with the license, terms, conditions,
* disclaimers, and limitations in the end user license agreement accompanying
* the software package with which this file was provided.
*******************************************************************************/

#include "BLE_1_HAL_PVT.h"

#if(CYBLE_MODE == CYBLE_HCI)

/*******************************************************************************
* Function Name: CyBLE_Uart_Start
****************************************************************************//**
*
*  Enables the platform UART Tx and RX interrupts and then enables the UART
*  component.
*
* \return
*  None
*
*******************************************************************************/
void CyBLE_Uart_Start (void)
{
    /* Setup ISR */
    BLE_1_uart_isr_StartEx(&CyBLE_Uart_Interrupt);

    BLE_1_HAL_Uart_Start();
}

/*******************************************************************************
* Function Name: CyBLE_Uart_Stop
****************************************************************************//**
*
*  Disables the UART, clears all pending interrupts and disables the UART Tx
*  and RX interrupts. This will also empty out the FIFOs.
*
* \return
*  None
*
*******************************************************************************/
void CyBLE_Uart_Stop (void)
{
    /* Stop interrupt and UART */
    BLE_1_uart_isr_Stop();

    BLE_1_HAL_Uart_Stop();
}

/*******************************************************************************
* Function Name: CyBLE_Uart_Transmit
****************************************************************************//**
*
*  Sends the data to Uart Tx FIFO. The API handles data length up to the
*  supported Tx FIFO length of the uart hardware module.
*
*  \param data: Pointer to the data to send through the UART
*  \param length: the length of data to transmit in bytes
*
* \return
*  None
*
*******************************************************************************/
void CyBLE_Uart_Transmit (const uint8 *dataBuf, uint8 length)
{
    BLE_1_HAL_Uart_SpiUartPutArray(dataBuf, (uint32)length);
}

/*******************************************************************************
* Function Name: CyBLE_Uart_Isr_Enable
****************************************************************************//**
*
*   Enables the UART interrupt to the interrupt controller.
*   Do not call this function unless CyBLE_Uart_Start() has been called or the
*   functionality of the SysInt_Init() function, which sets the vector and the
*   priority, has been called.
*
*******************************************************************************/
void CyBLE_Uart_Isr_Enable(void)
{
    BLE_1_uart_isr_Enable();
}

/*******************************************************************************
* Function Name: CyBLE_Uart_Isr_Disable
****************************************************************************//**
*
*   Disables the UART Interrupt in the interrupt controller.
*
*******************************************************************************/
void CyBLE_Uart_Isr_Disable(void)
{
     BLE_1_uart_isr_Disable();
}

#endif /* (CYBLE_MODE == CYBLE_HCI) */

/*******************************************************************************
* Function Name: CyBLE_Nvram_Write
****************************************************************************//**
*
*  This API writes the data to the NVRAM store. It will check the appropriate
*  alignment of a start address and also perform an address range check based
*  on the length before performing the write operation.
*  This function performs memory compare and writes only row where there are new
*  data to write.
*
*  \param buffer:   Pointer to the buffer containing the data to be stored.
*  \param varFlash: Pointer to the array or variable in the flash.
*  \param length:    The length of the data in bytes.
*
* \return
*  CYRET_SUCCESS    a successful write
*  CYRET_BAD_PARAM  A request to write outside the flash boundary.
*  CYRET_UNKNOWN    Other errors in writing the flash
*
* \sideeffect
*  For BLE devices with 128K of Flash memory this API will automatically
*  modify the clock settings for the device.
*  Writing to flash requires changes to be done to the IMO (set to 48 MHz)
*  and HFCLK (source set to IMO) settings. The configuration is restored before
*  returning. This will impact the operation of most of the hardware in the
*  device.
*
*******************************************************************************/
cystatus CyBLE_Nvram_Write (const uint8 buffer[], const uint8 varFlash[], uint16 length)
{
    uint8 writeBuffer[CY_FLASH_SIZEOF_ROW];
    uint32 rowId;
    uint32 dstIndex;
    uint32 srcIndex = 0u;
    cystatus rc = CYRET_SUCCESS;
    uint32 eeOffset;
    uint32 byteOffset;
    uint32 rowsNotEqual;

    eeOffset = (uint32)varFlash;

    /* Make sure, that varFlash[] points to Flash */
    if ((eeOffset + length) < CYBLE_HAL_FLASH_END_ADDR)
    {
        rowId = eeOffset / CY_FLASH_SIZEOF_ROW;
        byteOffset = CY_FLASH_SIZEOF_ROW * rowId;

        while ((srcIndex < length) && (rc == CYRET_SUCCESS))
        {
            rowsNotEqual = 0u;
            /* Copy data to the write buffer either from the source buffer or from the flash */
            for (dstIndex = 0u; dstIndex < CY_FLASH_SIZEOF_ROW; dstIndex++)
            {
                if ((byteOffset >= eeOffset) && (srcIndex < length))
                {
                    writeBuffer[dstIndex] = buffer[srcIndex];
                    /* Detect that row programming is required */
                    if(CY_GET_XTND_REG8(CYDEV_FLASH_BASE + byteOffset) != buffer[srcIndex])
                    {
                        rowsNotEqual = 1u;
                    }
                    srcIndex++;
                }
                else
                {
                    writeBuffer[dstIndex] = CY_GET_XTND_REG8(CYDEV_FLASH_BASE + byteOffset);
                }
                byteOffset++;
            }

            if(rowsNotEqual != 0u)
            {
                /* Write flash row */
                rc = CySysFlashWriteRow(rowId, writeBuffer);
            }

            /* Go to the next row */
            rowId++;
        }
    }
    else
    {
        rc = CYRET_BAD_PARAM;
    }

    /* Mask return codes from flash, if they are not supported */
    if ((CYRET_SUCCESS != rc) && (CYRET_BAD_PARAM != rc))
    {
        rc = CYRET_UNKNOWN;
    }

    return (rc);
}

/*******************************************************************************
* Function Name: CyBLE_Nvram_Erase
****************************************************************************//**
*
*  This API erases the data from the NVRAM store. This API will perform an
*  address range check based on the length before performing erase operation.
*
*  \param varFlash: the pointer to the array or variable in the flash.
*  \param length:    the length of the data in bytes.
*
* \return
*  CYRET_SUCCESS    a successful write
*  CYRET_BAD_PARAM  A request to write outside the flash boundary.
*  CYRET_UNKNOWN    Other errors in writing the flash
*
*******************************************************************************/
cystatus CyBLE_Nvram_Erase (const uint8 *varFlash, uint16 length)
{
    const uint8 *tempFlash;
    uint8 flashBuffer[CY_FLASH_SIZEOF_ROW] = {0u};
    uint16 lengthFlash;
    uint16 lengthRemaining;
    cystatus rc = CYRET_UNKNOWN;

    tempFlash = varFlash;
    lengthRemaining = length;

    while(lengthRemaining > 0u)
    {
        if(lengthRemaining < CY_FLASH_SIZEOF_ROW)
        {
            lengthFlash = lengthRemaining;
        }
        else
        {
            lengthFlash = CY_FLASH_SIZEOF_ROW;
        }
        rc = CyBLE_Nvram_Write(flashBuffer, tempFlash, lengthFlash);
        if(rc != CYRET_SUCCESS)
        {
            break;
        }
        tempFlash += CY_FLASH_SIZEOF_ROW;
        lengthRemaining -= lengthFlash;
    }

    return rc;
}

/*******************************************************************************
* Function Name: CyBLE_Bless_LlRegRead
****************************************************************************//**
*
*  This API reads the content of the BLESS Link Layer register from the stack.
*
*  \param blessAddr: the pointer to the BLESS link layer address.
*  \param regValue: the pointer to the buffer space to copy the read value.
*
* \return
*  None
*
*******************************************************************************/
void CyBLE_Bless_LlRegRead (const reg32 *blessAddr, uint16 *regValue)
{
    *regValue = (uint16)CY_GET_REG32(blessAddr);
}

/*******************************************************************************
* Function Name: CyBLE_Bless_LlRegWrite
****************************************************************************//**
*
*  This API writes to the BLESS Link Layer register from the stack.
*
*  \param blessAddr: the pointer to the BLESS link layer address.
*  \param regValue: the pointer to the value to be written to the BLESS LL reg.
*
* \return
*  None
*
*******************************************************************************/
void CyBLE_Bless_LlRegWrite (reg32 *blessAddr, const uint16 regValue)
{
    CY_SET_REG32(blessAddr, regValue);
}

/*******************************************************************************
* Function Name: CyBLE_Bless_RfRegRead
****************************************************************************//**
*
*  This API reads the content of the BLESS RF register from the stack.
*
*  \param blessAddr: the pointer to BLESS RF register address.
*  \param regValue: the pointer to the buffer space to copy the read value.
*
* \return
*  None
*
*******************************************************************************/
void CyBLE_Bless_RfRegRead (const reg32 *blessAddr, uint16 *regValue)
{
    *regValue = (uint16)CY_GET_REG32(blessAddr);
}

/*******************************************************************************
* Function Name: CyBLE_Bless_RfRegWrite
****************************************************************************//**
*
*  This API writes to the BLESS RF register from the stack.
*
*  \param blessAddr: the pointer to the BLESS RF address.
*  \param regValue: the pointer to the value to be written to the BLESS RF reg.
*
* \return
*  None
*
*******************************************************************************/
void CyBLE_Bless_RfRegWrite (reg32 *blessAddr, const uint16 regValue)
{
     CY_SET_REG32(blessAddr, regValue);
}

/*******************************************************************************
* Function Name: CyBLE_BlessDeviceConfig
****************************************************************************//**
*
*  This function configures BLESS registers by trimmed values stored in SFLASH.
*
* \return
*  None
*
*******************************************************************************/
void CyBLE_BlessDeviceConfig(void)
{

#if (CYIPBLOCK_m0s8bless_VERSION < 3)

    uint32 trimRegValue;
    uint32 ldo;
    uint16 trimRef34Val;
    uint16 trimRef38Val;
    uint32 siliconRev;

    trimRegValue = ((uint32)CYBLE_SFLASH_BLESS_BB_BUMP2_HIGH_REG << 8u) | CYBLE_SFLASH_BLESS_BB_BUMP2_LOW_REG;
    ldo = ((uint32)CYBLE_SFLASH_BLESS_LDO_HIGH_REG << 8u) | CYBLE_SFLASH_BLESS_LDO_LOW_REG;

    if ((ldo == CYBLE_SFLASH_BLERD_LDO_REG_VAL1) && (trimRegValue == CYBLE_SFLASH_BLERD_BB_BUMP2_REG_VAL1))
    {
        ldo = CYBLE_BLERD_LDO_REG_VAL_FINAL;
        trimRegValue = CYBLE_BLERD_BB_BUMP2_REG_VAL_FINAL;
    }
    else if ((ldo == CYBLE_SFLASH_BLERD_LDO_REG_VAL2) && (trimRegValue == CYBLE_BLERD_BB_BUMP2_REG_VAL_FINAL))
    {
        ldo = CYBLE_BLERD_LDO_REG_VAL_FINAL;
    }
    else
    {
    }

    CYBLE_BLE_BLERD_LDO_REG = ldo;
    CYBLE_BLE_BLERD_BB_BUMP2_REG = trimRegValue;

    /* Edit only XTAL fast charge bit */
    trimRegValue = ((uint32)CYBLE_SFLASH_BLESS_BB_XO_HIGH_REG << 8u) | CYBLE_SFLASH_BLESS_BB_XO_LOW_REG;

    if ((trimRegValue == CYBLE_SFLASH_BLERD_BB_XO_REG_VAL1) || (trimRegValue == CYBLE_SFLASH_BLERD_BB_XO_REG_VAL2))
    {
        trimRegValue = CYBLE_BLERD_BB_XO_REG_VAL_FINAL;
    }

    CYBLE_BLE_BLERD_BB_XO_REG = trimRegValue;

    trimRegValue = ((uint32)CYBLE_SFLASH_BLESS_SY_BUMP1_HIGH_REG << 8u) | CYBLE_SFLASH_BLESS_SY_BUMP1_LOW_REG;

    if ((trimRegValue == CYBLE_SFLASH_BLERD_SY_BUMP1_REG_VAL1) ||
        (trimRegValue == CYBLE_SFLASH_BLERD_SY_BUMP1_REG_VAL2) ||
        (trimRegValue == CYBLE_SFLASH_BLERD_SY_BUMP1_REG_VAL3))
    {
        trimRegValue = CYBLE_BLERD_SY_BUMP1_REG_VAL_FINAL;
    }
    CYBLE_BLE_BLERD_SY_BUMP1_REG = trimRegValue;

    /* Following code is for F02FN trimming */
    siliconRev = (CYBLE_BLE_SILICON_REV_REG >> 4u);

    if((CYBLE_BLE_FAMILY_ID_REG == CYBLE_PSOC4A_BLE256DMA_FID) && (siliconRev >= 0x02u) &&
        (CYBLE_SFLASH_BLESS_SY_BUMP1_HIGH_REG == 0x0Eu))
	{
		trimRef34Val = ((uint16)(((uint16) CYBLE_BLE_BLESS_REG34_TRIM_HIGH_REG) << 8u)) |
                        ((uint16)CYBLE_BLE_BLESS_REG34_TRIM_LOW_REG);
		CYBLE_BLERD_SY_BUMP2_REG = trimRef34Val;

		trimRef38Val = ((uint16)(((uint16)CYBLE_BLE_BLESS_REG38_TRIM_HIGH_REG) << 8u)) |
            ((uint16) CYBLE_BLE_BLESS_REG38_TRIM_LOW_REG);
		CYBLE_BLERD_RX_BUMP2_REG = trimRef38Val;
	}
#endif /* (CYIPBLOCK_m0s8bless_VERSION < 3) */
}

/* Interface to CyDelayUs function */
void CyBleHal_DelayUs(uint16 delayVal)
{
    CyDelayUs(delayVal);
}

/* Interface to CyDelay function */
void CyBleHal_DelayMs(uint32 delayVal)
{
    CyDelay(delayVal);
}

/* Interface to BLE_1_bless_isr_Enable function */
void CyBleHal_EnableGlobalInterrupts(void)
{
    BLE_1_bless_isr_Enable();
}

/* Interface to BLE_1_bless_isr_Disable function */
void CyBleHal_DisableGlobalInterrupts(void)
{
    BLE_1_bless_isr_Disable();
}

/*******************************************************************************
* Function Name: CyBle_HalInit
****************************************************************************//**
*
*  Initializes the BLESS interrupt.
*
* \return
*  None
*
*******************************************************************************/
void CyBle_HalInit(void)
{
    /* For all we know the interrupt is active. */
    BLE_1_bless_isr_Disable();

    /* Set the ISR to point to the BLE_bless_isr Interrupt. */
    BLE_1_bless_isr_SetVector(&CyBLE_Bless_Interrupt);

    /* Set the priority. */
    BLE_1_bless_isr_SetPriority((uint8)BLE_1_bless_isr_INTC_PRIOR_NUMBER);
}

/*******************************************************************************
* Function Name: CYBLE_BlessStart
****************************************************************************//**
*
*  Start Interrupt Controller API.
*
* \return
*  None
*
*******************************************************************************/
void CYBLE_BlessStart(void)
{
#if((CYBLE_M0S8BLESS_VERSION_3) && (CYBLE_EXT_PA_ENABLED))
    CYBLE_EXT_PA_LNA_CTRL_REG |= CYBLE_EXT_PA_LNA_ENABLE | CYBLE_EXT_OUT_EN_DRIVE_VAL;
#endif  /* (CYBLE_M0S8BLESS_VERSION_3) */

    BLE_1_bless_isr_StartEx(&CyBLE_Bless_Interrupt);
}

/*******************************************************************************
* Function Name: CyBLE_GetIpBlockVersion
****************************************************************************//**
*
* This API returns the version of m0s8bless ip block.
*
* \return
* uint32 bits:
* 7:0 - ip version ( 1 - BLE_ver1, 2 - BLE_ver2, 3 - BLE_ver3 )
* 15:8 - flash size ( 0 - 128k, 1 - 256k )
* 16 - PSVP device
* 31:17 - reserved for future usage
*
*******************************************************************************/
uint32 CyBLE_GetIpBlockVersion(void)
{
    return(((uint32)CYBLE_M0S8BLESS_VERSION) | ((uint32)((uint32)CYBLE_FLASH_SIZE) << 8u) |
        ((uint32)(((uint32)CYBLE_PSVP_DEVICE)) << 16u));
}

/* Mapping functions for stack size optimization */
#if(CYBLE_MODE_PROFILE)

#if(CYBLE_SECURE_CONN_FEATURE_ENABLED)

    CYBLE_API_RESULT_T CyBle_Hal_pairing_local_public_key_handler(void *param)
    {
        return (CyBle_Hal_mapping_pairing_local_public_key_handler(param));
    }

    CYBLE_API_RESULT_T CyBle_Hal_pairing_remote_key_handler(void *param)
    {
        return (CyBle_Hal_mapping_pairing_remote_key_handler(param));
    }

    CYBLE_API_RESULT_T CyBle_Hal_pairing_dhkey_handler(void *param)
    {
        return (CyBle_Hal_mapping_pairing_dhkey_handler(param));
    }

    CYBLE_API_RESULT_T CyBle_Hal_pairing_dhkey_check_handler(void *param)
    {
        return (CyBle_Hal_mapping_pairing_dhkey_check_handler(param));
    }

    CYBLE_API_RESULT_T CyBle_Hal_pairing_keypress_notification_handler(void *param)
    {
        return (CyBle_Hal_mapping_pairing_keypress_notification_handler(param));
    }

    CYBLE_API_RESULT_T CyBle_Hal_pairing_rand_handler(void *param)
    {
        return (CyBle_Hal_mapping_pairing_rand_handler(param));
    }

    CYBLE_API_RESULT_T CyBle_Hal_pairing_confirm_handler(void *param)
    {
        return (CyBle_Hal_mapping_pairing_confirm_handler(param));
    }

    CYBLE_API_RESULT_T CyBle_Hal_pairing_lr_confirming_handler(void *param)
    {
        return (CyBle_Hal_mapping_pairing_lr_confirming_handler(param));
    }

    CYBLE_API_RESULT_T CyBle_Hal_pairing_sc_tbx_dhkey_generate_complete(void* param)
    {
        CyBle_Hal_mapping_tbx_dhkey_generate_complete(param);
        return (CYBLE_ERROR_OK);
    }

    CYBLE_API_RESULT_T CyBle_Hal_pairing_sc_tbx_local_pubkey_generate_complete(void)
    {
        CyBle_Hal_mapping_tbx_local_pubkey_generate_complete();
        return (CYBLE_ERROR_OK);
    }

    CYBLE_API_RESULT_T CyBle_Hal_pairing_sc_tbx_generate_local_P256_public_key(uint8 param)
    {
        return (CyBle_Hal_mapping_tbx_generate_local_P256_public_key(param));
    }

    CYBLE_API_RESULT_T CyBle_Hal_pairing_sc_tbx_generate_DHkey(void  * param1, void  * param2)
    {
        return (CyBle_Hal_mapping_tbx_generate_DHkey(param1, param2));
    }

    void CyBle_Hal_smp_sc_cmac_complete(void)
    {
       CyBle_Hal_Mapping_smp_sc_cmac_complete();
    }

    CYBLE_API_RESULT_T CyBle_Hal_se_smp_sc_user_passkey_handler(void *param1, void *param2)
    {
        return (CyBle_Hal_mapping_se_smp_sc_user_passkey_handler(param1, param2));
    }

    void CyBle_Hal_EccPointMult(void)
    {
        CyBle_Hal_Mapping_EccPointMult();
    }

#else     /* If feature is not required, return error. */

    CYBLE_API_RESULT_T CyBle_Hal_pairing_local_public_key_handler(void *param CYBLE_UNUSED_ATTR)
    {
        return (CYBLE_ERROR_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE);
    }

    CYBLE_API_RESULT_T CyBle_Hal_pairing_remote_key_handler(void *param CYBLE_UNUSED_ATTR)
    {
        return (CYBLE_ERROR_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE);
    }

    CYBLE_API_RESULT_T CyBle_Hal_pairing_dhkey_handler(void *param CYBLE_UNUSED_ATTR)
    {
        return (CYBLE_ERROR_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE);
    }

    CYBLE_API_RESULT_T CyBle_Hal_pairing_dhkey_check_handler(void *param CYBLE_UNUSED_ATTR)
    {
        return (CYBLE_ERROR_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE);
    }

    CYBLE_API_RESULT_T CyBle_Hal_pairing_keypress_notification_handler(void *param CYBLE_UNUSED_ATTR)
    {
        return (CYBLE_ERROR_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE);
    }

    CYBLE_API_RESULT_T CyBle_Hal_pairing_rand_handler(void *param CYBLE_UNUSED_ATTR)
    {
        return (CYBLE_ERROR_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE);
    }

    CYBLE_API_RESULT_T CyBle_Hal_pairing_confirm_handler(void *param CYBLE_UNUSED_ATTR)
    {
        return (CYBLE_ERROR_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE);
    }

    CYBLE_API_RESULT_T CyBle_Hal_pairing_lr_confirming_handler(void *param CYBLE_UNUSED_ATTR)
    {
        return (CYBLE_ERROR_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE);
    }

    CYBLE_API_RESULT_T CyBle_Hal_pairing_sc_tbx_dhkey_generate_complete(void* param CYBLE_UNUSED_ATTR)
    {
        return (CYBLE_ERROR_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE);
    }

    CYBLE_API_RESULT_T CyBle_Hal_pairing_sc_tbx_local_pubkey_generate_complete(void)
    {
        return (CYBLE_ERROR_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE);
    }

    CYBLE_API_RESULT_T CyBle_Hal_pairing_sc_tbx_generate_local_P256_public_key(uint8 param CYBLE_UNUSED_ATTR)
    {
        return (CYBLE_ERROR_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE);
    }

    CYBLE_API_RESULT_T CyBle_Hal_pairing_sc_tbx_generate_DHkey(void  * param1 CYBLE_UNUSED_ATTR,
                                                               void  * param2 CYBLE_UNUSED_ATTR)
    {
        return (CYBLE_ERROR_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE);
    }

    void CyBle_Hal_smp_sc_cmac_complete(void)
    {
    }

    CYBLE_API_RESULT_T CyBle_Hal_se_smp_sc_user_passkey_handler(void  * param1 CYBLE_UNUSED_ATTR,
                                                                void  * param2 CYBLE_UNUSED_ATTR)
    {
        return (CYBLE_ERROR_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE);
    }

    void CyBle_Hal_EccPointMult(void)
    {
    }

#endif /* (CYBLE_SECURE_CONN_FEATURE_ENABLED) */

#endif /* CYBLE_MODE_PROFILE */

#if(CYBLE_SECURE_CONN_FEATURE_ENABLED)

    uint16 BLE_CMP_FTR_API_lec_hci_handle_read_local_P256_public_key_command(void *param)
    {
        return (BLE_STK_FTR_API_lec_hci_handle_read_local_P256_public_key_command(param));
    }

    uint16 BLE_CMP_FTR_API_lec_hci_handle_generate_DHkey_command(void *param)
    {
        return (BLE_STK_FTR_API_lec_hci_handle_generate_DHkey_command(param));
    }

#else     /* If feature is not required, return error. */

    uint16 BLE_CMP_FTR_API_lec_hci_handle_read_local_P256_public_key_command(void *param CYBLE_UNUSED_ATTR)
    {
        return (CYBLE_UNKNOWN_HCI_COMMAND_ERROR);
    }

    uint16 BLE_CMP_FTR_API_lec_hci_handle_generate_DHkey_command(void *param CYBLE_UNUSED_ATTR)
    {
        return (CYBLE_UNKNOWN_HCI_COMMAND_ERROR);
    }

#endif /* CYBLE_SECURE_CONN_FEATURE_ENABLED */

/* [] END OF FILE */


text:
#include "config.h"
#include "modules/webmidi/MIDIInput.h"

#include "modules/webmidi/MIDIAccess.h"
#include "modules/webmidi/MIDIMessageEvent.h"
#include "platform/heap/Handle.h"

namespace blink {

using PortState = MIDIAccessor::MIDIPortState;

MIDIInput* MIDIInput::create(MIDIAccess* access, const String& id, const String& manufacturer, const String& name, const String& version, PortState state)
{
    ASSERT(access);
    MIDIInput* input = new MIDIInput(access, id, manufacturer, name, version, state);
    input->suspendIfNeeded();
    return input;
}

MIDIInput::MIDIInput(MIDIAccess* access, const String& id, const String& manufacturer, const String& name, const String& version, PortState state)
    : MIDIPort(access, id, manufacturer, name, TypeInput, version, state)
{
}

EventListener* MIDIInput::onmidimessage()
{
    return getAttributeEventListener(EventTypeNames::midimessage);
}

void MIDIInput::setOnmidimessage(PassRefPtrWillBeRawPtr<EventListener> listener)
{
    // Implicit open. It does nothing if the port is already opened.
    // See http://www.w3.org/TR/webmidi/#widl-MIDIPort-open-Promise-MIDIPort
    open();

    setAttributeEventListener(EventTypeNames::midimessage, listener);
}

bool MIDIInput::addEventListener(const AtomicString& eventType, PassRefPtrWillBeRawPtr<EventListener> listener, bool useCapture)
{
    if (eventType == EventTypeNames::midimessage) {
        // Implicit open. See setOnmidimessage().
        open();
    }
    return EventTarget::addEventListener(eventType, listener, useCapture);
}

void MIDIInput::didReceiveMIDIData(unsigned portIndex, const unsigned char* data, size_t length, double timeStamp)
{
    ASSERT(isMainThread());

    if (!length)
        return;

    if (getConnection() != ConnectionStateOpen)
        return;

    // Drop sysex message here when the client does not request it. Note that this is not a security check but an
    // automatic filtering for clients that do not want sysex message. Also note that sysex message will never be sent
    // unless the current process has an explicit permission to handle sysex message.
    if (data[0] == 0xf0 && !midiAccess()->sysexEnabled())
        return;
    RefPtr<DOMUint8Array> array = DOMUint8Array::create(data, length);
    dispatchEvent(MIDIMessageEvent::create(timeStamp, array));
}

DEFINE_TRACE(MIDIInput)
{
    MIDIPort::trace(visitor);
}

} // namespace blink


text:
namespace Vaskelista.Migrations
{
    using System.CodeDom.Compiler;
    using System.Data.Entity.Migrations;
    using System.Data.Entity.Migrations.Infrastructure;
    using System.Resources;

    [GeneratedCode("EntityFramework.Migrations", "6.0.0-20911")]
    public sealed partial class RoomHouseholdRelation : IMigrationMetadata
    {
        private readonly ResourceManager Resources = new ResourceManager(typeof(RoomHouseholdRelation));

        string IMigrationMetadata.Id
        {
            get { return "201409021138021_RoomHouseholdRelation"; }
        }

        string IMigrationMetadata.Source
        {
            get { return null; }
        }

        string IMigrationMetadata.Target
        {
            get { return Resources.GetString("Target"); }
        }
    }
}


text:
<!doctype html>

        <meta charset="utf-8">
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <title>Merissa Acosta | Web Developer and Digital Designer</title>
        <meta name="description" content="Merissa Acosta Portfolio Website">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="keywords" content="web developer, web developent, ui designer, ui developer, chicago, portfolio, programming, work, digital design, design, web design" />
        <meta name="author" content="Merissa Acosta"/>

        <link rel="apple-touch-icon" href="apple-touch-icon.png">

        <link rel="icon"
				      type="image/png"
				      href="../favicon.png">

        <link rel="stylesheet" href="../css/normalize.css">

				<link href="../css/bootstrap.min.css" rel="stylesheet">
				<link rel="stylesheet" href="../css/main.css">

        <link href="https://fonts.googleapis.com/css?family=Josefin+Sans" rel="stylesheet">
        <link href="https://fonts.googleapis.com/css?family=Sacramento" rel="stylesheet">

						<svg width="51px" height="22px" viewBox="0 0 51 22" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
							    <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
							        <g id="DEV-PORTFOLIO" transform="translate(-73.000000, -62.000000)">
							            <g id="Group" transform="translate(76.000000, 54.000000)">
							                <g id="arrow" transform="translate(24.000000, 19.000000) scale(-1, 1) translate(-24.000000, -19.000000) translate(0.000000, 9.000000)">
							                    <path d="M0,10.45695 L47.6170213,10.45695 L0,10.45695 Z" id="Fill-1" fill="#fff"></path>
							                    <g id="Group-6" transform="translate(0.000000, 0.381850)" stroke="#fff" stroke-width="4">
							                        <path d="M47.6170213,9.82758621 L0,9.82758621" id="Stroke-2"></path>
							                        <polyline id="Stroke-4" points="36.7659574 0.30225 47.6170213 10.07525 36.7659574 18.30225"></polyline>
							                    </g>
							                </g>
							            </g>
							        </g>
							    </g>
							</svg>

Back

Suits + Tables

Suits + Tables is a free online service to book events at restaurants. My role in this website is to redesign their current site to make it look fresh and clean. This fresh and clean feel appeals to their target audience, which are mostly people who work in corporate businesses. I used white clean backgrounds and their signature blue as an accent color. I also created fun and colorful icons for each of their venue categories to liven the page up.

Site going live in 2017.

Home Page

How it Works Page

Browse Venues Page

Venue Page

User Portal - Message with Venue

Venue Portal Dashboard


text:
#pragma once
#include <aws/application-autoscaling/ApplicationAutoScaling_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/application-autoscaling/model/ServiceNamespace.h>
#include <aws/application-autoscaling/model/ScalableDimension.h>
#include <aws/core/utils/DateTime.h>
#include <aws/application-autoscaling/model/ScalableTargetAction.h>
#include <utility>

namespace Aws
{
namespace Utils
{
namespace Json
{
  class JsonValue;
  class JsonView;
} // namespace Json
} // namespace Utils
namespace ApplicationAutoScaling
{
namespace Model
{

  /**
   *
Represents a scheduled action.

See Also:
   AWS
   * API Reference

   */
  class AWS_APPLICATIONAUTOSCALING_API ScheduledAction
  {
  public:
    ScheduledAction();
    ScheduledAction(Aws::Utils::Json::JsonView jsonValue);
    ScheduledAction& operator=(Aws::Utils::Json::JsonView jsonValue);
    Aws::Utils::Json::JsonValue Jsonize() const;

    /**
     *
The name of the scheduled action.

     */
    inline const Aws::String& GetScheduledActionName() const{ return m_scheduledActionName; }

    /**
     *
The name of the scheduled action.

     */
    inline void SetScheduledActionName(const Aws::String& value) { m_scheduledActionNameHasBeenSet = true; m_scheduledActionName = value; }

    /**
     *
The name of the scheduled action.

     */
    inline void SetScheduledActionName(Aws::String&& value) { m_scheduledActionNameHasBeenSet = true; m_scheduledActionName = std::move(value); }

    /**
     *
The name of the scheduled action.

     */
    inline void SetScheduledActionName(const char* value) { m_scheduledActionNameHasBeenSet = true; m_scheduledActionName.assign(value); }

    /**
     *
The name of the scheduled action.

     */
    inline ScheduledAction& WithScheduledActionName(const Aws::String& value) { SetScheduledActionName(value); return *this;}

    /**
     *
The name of the scheduled action.

     */
    inline ScheduledAction& WithScheduledActionName(Aws::String&& value) { SetScheduledActionName(std::move(value)); return *this;}

    /**
     *
The name of the scheduled action.

     */
    inline ScheduledAction& WithScheduledActionName(const char* value) { SetScheduledActionName(value); return *this;}

    /**
     *
The Amazon Resource Name (ARN) of the scheduled action.

     */
    inline const Aws::String& GetScheduledActionARN() const{ return m_scheduledActionARN; }

    /**
     *
The Amazon Resource Name (ARN) of the scheduled action.

     */
    inline void SetScheduledActionARN(const Aws::String& value) { m_scheduledActionARNHasBeenSet = true; m_scheduledActionARN = value; }

    /**
     *
The Amazon Resource Name (ARN) of the scheduled action.

     */
    inline void SetScheduledActionARN(Aws::String&& value) { m_scheduledActionARNHasBeenSet = true; m_scheduledActionARN = std::move(value); }

    /**
     *
The Amazon Resource Name (ARN) of the scheduled action.

     */
    inline void SetScheduledActionARN(const char* value) { m_scheduledActionARNHasBeenSet = true; m_scheduledActionARN.assign(value); }

    /**
     *
The Amazon Resource Name (ARN) of the scheduled action.

     */
    inline ScheduledAction& WithScheduledActionARN(const Aws::String& value) { SetScheduledActionARN(value); return *this;}

    /**
     *
The Amazon Resource Name (ARN) of the scheduled action.

     */
    inline ScheduledAction& WithScheduledActionARN(Aws::String&& value) { SetScheduledActionARN(std::move(value)); return *this;}

    /**
     *
The Amazon Resource Name (ARN) of the scheduled action.

     */
    inline ScheduledAction& WithScheduledActionARN(const char* value) { SetScheduledActionARN(value); return *this;}

    /**
     *
The namespace of the AWS service that provides the resource or
     * custom-resource for a resource provided by your own application or
     * service. For more information, see AWS
     * Service Namespaces in the Amazon Web Services General Reference.

     */
    inline const ServiceNamespace& GetServiceNamespace() const{ return m_serviceNamespace; }

    /**
     *
The namespace of the AWS service that provides the resource or
     * custom-resource for a resource provided by your own application or
     * service. For more information, see AWS
     * Service Namespaces in the Amazon Web Services General Reference.

     */
    inline void SetServiceNamespace(const ServiceNamespace& value) { m_serviceNamespaceHasBeenSet = true; m_serviceNamespace = value; }

    /**
     *
The namespace of the AWS service that provides the resource or
     * custom-resource for a resource provided by your own application or
     * service. For more information, see AWS
     * Service Namespaces in the Amazon Web Services General Reference.

     */
    inline void SetServiceNamespace(ServiceNamespace&& value) { m_serviceNamespaceHasBeenSet = true; m_serviceNamespace = std::move(value); }

    /**
     *
The namespace of the AWS service that provides the resource or
     * custom-resource for a resource provided by your own application or
     * service. For more information, see AWS
     * Service Namespaces in the Amazon Web Services General Reference.

     */
    inline ScheduledAction& WithServiceNamespace(const ServiceNamespace& value) { SetServiceNamespace(value); return *this;}

    /**
     *
The namespace of the AWS service that provides the resource or
     * custom-resource for a resource provided by your own application or
     * service. For more information, see AWS
     * Service Namespaces in the Amazon Web Services General Reference.

     */
    inline ScheduledAction& WithServiceNamespace(ServiceNamespace&& value) { SetServiceNamespace(std::move(value)); return *this;}

    /**
     *
The schedule for this action. The following formats are supported:

     *

At expressions -
     * at(yyyy-mm-ddThh:mm:ss)
     *

Rate expressions - rate(value
     * unit)

Cron expressions -
     * cron(fields)

At expressions are useful
     * for one-time schedules. Specify the time, in UTC.

For rate expressions,
     * value is a positive integer and unit is minute |
     * minutes | hour | hours | day
     * | days.

For more information about cron expressions, see Cron
     * Expressions in the Amazon CloudWatch Events User Guide.

     */
    inline const Aws::String& GetSchedule() const{ return m_schedule; }

    /**
     *
The schedule for this action. The following formats are supported:

     *

At expressions -
     * at(yyyy-mm-ddThh:mm:ss)
     *

Rate expressions - rate(value
     * unit)

Cron expressions -
     * cron(fields)

At expressions are useful
     * for one-time schedules. Specify the time, in UTC.

For rate expressions,
     * value is a positive integer and unit is minute |
     * minutes | hour | hours | day
     * | days.

For more information about cron expressions, see Cron
     * Expressions in the Amazon CloudWatch Events User Guide.

     */
    inline void SetSchedule(const Aws::String& value) { m_scheduleHasBeenSet = true; m_schedule = value; }

    /**
     *
The schedule for this action. The following formats are supported:

     *

At expressions -
     * at(yyyy-mm-ddThh:mm:ss)
     *

Rate expressions - rate(value
     * unit)

Cron expressions -
     * cron(fields)

At expressions are useful
     * for one-time schedules. Specify the time, in UTC.

For rate expressions,
     * value is a positive integer and unit is minute |
     * minutes | hour | hours | day
     * | days.

For more information about cron expressions, see Cron
     * Expressions in the Amazon CloudWatch Events User Guide.

     */
    inline void SetSchedule(Aws::String&& value) { m_scheduleHasBeenSet = true; m_schedule = std::move(value); }

    /**
     *
The schedule for this action. The following formats are supported:

     *

At expressions -
     * at(yyyy-mm-ddThh:mm:ss)
     *

Rate expressions - rate(value
     * unit)

Cron expressions -
     * cron(fields)

At expressions are useful
     * for one-time schedules. Specify the time, in UTC.

For rate expressions,
     * value is a positive integer and unit is minute |
     * minutes | hour | hours | day
     * | days.

For more information about cron expressions, see Cron
     * Expressions in the Amazon CloudWatch Events User Guide.

     */
    inline void SetSchedule(const char* value) { m_scheduleHasBeenSet = true; m_schedule.assign(value); }

    /**
     *
The schedule for this action. The following formats are supported:

     *

At expressions -
     * at(yyyy-mm-ddThh:mm:ss)
     *

Rate expressions - rate(value
     * unit)

Cron expressions -
     * cron(fields)

At expressions are useful
     * for one-time schedules. Specify the time, in UTC.

For rate expressions,
     * value is a positive integer and unit is minute |
     * minutes | hour | hours | day
     * | days.

For more information about cron expressions, see Cron
     * Expressions in the Amazon CloudWatch Events User Guide.

     */
    inline ScheduledAction& WithSchedule(const Aws::String& value) { SetSchedule(value); return *this;}

    /**
     *
The schedule for this action. The following formats are supported:

     *

At expressions -
     * at(yyyy-mm-ddThh:mm:ss)
     *

Rate expressions - rate(value
     * unit)

Cron expressions -
     * cron(fields)

At expressions are useful
     * for one-time schedules. Specify the time, in UTC.

For rate expressions,
     * value is a positive integer and unit is minute |
     * minutes | hour | hours | day
     * | days.

For more information about cron expressions, see Cron
     * Expressions in the Amazon CloudWatch Events User Guide.

     */
    inline ScheduledAction& WithSchedule(Aws::String&& value) { SetSchedule(std::move(value)); return *this;}

    /**
     *
The schedule for this action. The following formats are supported:

     *

At expressions -
     * at(yyyy-mm-ddThh:mm:ss)
     *

Rate expressions - rate(value
     * unit)

Cron expressions -
     * cron(fields)

At expressions are useful
     * for one-time schedules. Specify the time, in UTC.

For rate expressions,
     * value is a positive integer and unit is minute |
     * minutes | hour | hours | day
     * | days.

For more information about cron expressions, see Cron
     * Expressions in the Amazon CloudWatch Events User Guide.

     */
    inline ScheduledAction& WithSchedule(const char* value) { SetSchedule(value); return *this;}

    /**
     *
The identifier of the resource associated with the scaling policy. This
     * string consists of the resource type and unique identifier.

ECS
     * service - The resource type is service and the unique identifier is
     * the cluster name and service name. Example:
     * service/default/sample-webapp.

Spot fleet request
     * - The resource type is spot-fleet-request and the unique identifier
     * is the Spot fleet request ID. Example:
     * spot-fleet-request/sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE.

     *

EMR cluster - The resource type is instancegroup and
     * the unique identifier is the cluster ID and instance group ID. Example:
     * instancegroup/j-2EEZNYKUA1NTV/ig-1791Y4E1L8YI0.

     *
AppStream 2.0 fleet - The resource type is fleet and the unique
     * identifier is the fleet name. Example: fleet/sample-fleet.

     *

DynamoDB table - The resource type is table and the
     * unique identifier is the resource ID. Example: table/my-table.

     *

DynamoDB global secondary index - The resource type is
     * index and the unique identifier is the resource ID. Example:
     * table/my-table/index/my-table-index.

Aurora DB
     * cluster - The resource type is cluster and the unique identifier is
     * the cluster name. Example: cluster:my-db-cluster.

     *
Amazon SageMaker endpoint variants - The resource type is
     * variant and the unique identifier is the resource ID. Example:
     * endpoint/my-end-point/variant/KMeansClustering.

     *
Custom resources are not supported with a resource type. This parameter must
     * specify the OutputValue from the CloudFormation template stack used
     * to access the resources. The unique identifier is defined by the service
     * provider.

     */
    inline const Aws::String& GetResourceId() const{ return m_resourceId; }

    /**
     *
The identifier of the resource associated with the scaling policy. This
     * string consists of the resource type and unique identifier.

ECS
     * service - The resource type is service and the unique identifier is
     * the cluster name and service name. Example:
     * service/default/sample-webapp.

Spot fleet request
     * - The resource type is spot-fleet-request and the unique identifier
     * is the Spot fleet request ID. Example:
     * spot-fleet-request/sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE.

     *

EMR cluster - The resource type is instancegroup and
     * the unique identifier is the cluster ID and instance group ID. Example:
     * instancegroup/j-2EEZNYKUA1NTV/ig-1791Y4E1L8YI0.

     *
AppStream 2.0 fleet - The resource type is fleet and the unique
     * identifier is the fleet name. Example: fleet/sample-fleet.

     *

DynamoDB table - The resource type is table and the
     * unique identifier is the resource ID. Example: table/my-table.

     *

DynamoDB global secondary index - The resource type is
     * index and the unique identifier is the resource ID. Example:
     * table/my-table/index/my-table-index.

Aurora DB
     * cluster - The resource type is cluster and the unique identifier is
     * the cluster name. Example: cluster:my-db-cluster.

     *
Amazon SageMaker endpoint variants - The resource type is
     * variant and the unique identifier is the resource ID. Example:
     * endpoint/my-end-point/variant/KMeansClustering.

     *
Custom resources are not supported with a resource type. This parameter must
     * specify the OutputValue from the CloudFormation template stack used
     * to access the resources. The unique identifier is defined by the service
     * provider.

     */
    inline void SetResourceId(const Aws::String& value) { m_resourceIdHasBeenSet = true; m_resourceId = value; }

    /**
     *
The identifier of the resource associated with the scaling policy. This
     * string consists of the resource type and unique identifier.

ECS
     * service - The resource type is service and the unique identifier is
     * the cluster name and service name. Example:
     * service/default/sample-webapp.

Spot fleet request
     * - The resource type is spot-fleet-request and the unique identifier
     * is the Spot fleet request ID. Example:
     * spot-fleet-request/sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE.

     *

EMR cluster - The resource type is instancegroup and
     * the unique identifier is the cluster ID and instance group ID. Example:
     * instancegroup/j-2EEZNYKUA1NTV/ig-1791Y4E1L8YI0.

     *
AppStream 2.0 fleet - The resource type is fleet and the unique
     * identifier is the fleet name. Example: fleet/sample-fleet.

     *

DynamoDB table - The resource type is table and the
     * unique identifier is the resource ID. Example: table/my-table.

     *

DynamoDB global secondary index - The resource type is
     * index and the unique identifier is the resource ID. Example:
     * table/my-table/index/my-table-index.

Aurora DB
     * cluster - The resource type is cluster and the unique identifier is
     * the cluster name. Example: cluster:my-db-cluster.

     *
Amazon SageMaker endpoint variants - The resource type is
     * variant and the unique identifier is the resource ID. Example:
     * endpoint/my-end-point/variant/KMeansClustering.

     *
Custom resources are not supported with a resource type. This parameter must
     * specify the OutputValue from the CloudFormation template stack used
     * to access the resources. The unique identifier is defined by the service
     * provider.

     */
    inline void SetResourceId(Aws::String&& value) { m_resourceIdHasBeenSet = true; m_resourceId = std::move(value); }

    /**
     *
The identifier of the resource associated with the scaling policy. This
     * string consists of the resource type and unique identifier.

ECS
     * service - The resource type is service and the unique identifier is
     * the cluster name and service name. Example:
     * service/default/sample-webapp.

Spot fleet request
     * - The resource type is spot-fleet-request and the unique identifier
     * is the Spot fleet request ID. Example:
     * spot-fleet-request/sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE.

     *

EMR cluster - The resource type is instancegroup and
     * the unique identifier is the cluster ID and instance group ID. Example:
     * instancegroup/j-2EEZNYKUA1NTV/ig-1791Y4E1L8YI0.

     *
AppStream 2.0 fleet - The resource type is fleet and the unique
     * identifier is the fleet name. Example: fleet/sample-fleet.

     *

DynamoDB table - The resource type is table and the
     * unique identifier is the resource ID. Example: table/my-table.

     *

DynamoDB global secondary index - The resource type is
     * index and the unique identifier is the resource ID. Example:
     * table/my-table/index/my-table-index.

Aurora DB
     * cluster - The resource type is cluster and the unique identifier is
     * the cluster name. Example: cluster:my-db-cluster.

     *
Amazon SageMaker endpoint variants - The resource type is
     * variant and the unique identifier is the resource ID. Example:
     * endpoint/my-end-point/variant/KMeansClustering.

     *
Custom resources are not supported with a resource type. This parameter must
     * specify the OutputValue from the CloudFormation template stack used
     * to access the resources. The unique identifier is defined by the service
     * provider.

     */
    inline void SetResourceId(const char* value) { m_resourceIdHasBeenSet = true; m_resourceId.assign(value); }

    /**
     *
The identifier of the resource associated with the scaling policy. This
     * string consists of the resource type and unique identifier.

ECS
     * service - The resource type is service and the unique identifier is
     * the cluster name and service name. Example:
     * service/default/sample-webapp.

Spot fleet request
     * - The resource type is spot-fleet-request and the unique identifier
     * is the Spot fleet request ID. Example:
     * spot-fleet-request/sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE.

     *

EMR cluster - The resource type is instancegroup and
     * the unique identifier is the cluster ID and instance group ID. Example:
     * instancegroup/j-2EEZNYKUA1NTV/ig-1791Y4E1L8YI0.

     *
AppStream 2.0 fleet - The resource type is fleet and the unique
     * identifier is the fleet name. Example: fleet/sample-fleet.

     *

DynamoDB table - The resource type is table and the
     * unique identifier is the resource ID. Example: table/my-table.

     *

DynamoDB global secondary index - The resource type is
     * index and the unique identifier is the resource ID. Example:
     * table/my-table/index/my-table-index.

Aurora DB
     * cluster - The resource type is cluster and the unique identifier is
     * the cluster name. Example: cluster:my-db-cluster.

     *
Amazon SageMaker endpoint variants - The resource type is
     * variant and the unique identifier is the resource ID. Example:
     * endpoint/my-end-point/variant/KMeansClustering.

     *
Custom resources are not supported with a resource type. This parameter must
     * specify the OutputValue from the CloudFormation template stack used
     * to access the resources. The unique identifier is defined by the service
     * provider.

     */
    inline ScheduledAction& WithResourceId(const Aws::String& value) { SetResourceId(value); return *this;}

    /**
     *
The identifier of the resource associated with the scaling policy. This
     * string consists of the resource type and unique identifier.

ECS
     * service - The resource type is service and the unique identifier is
     * the cluster name and service name. Example:
     * service/default/sample-webapp.

Spot fleet request
     * - The resource type is spot-fleet-request and the unique identifier
     * is the Spot fleet request ID. Example:
     * spot-fleet-request/sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE.

     *

EMR cluster - The resource type is instancegroup and
     * the unique identifier is the cluster ID and instance group ID. Example:
     * instancegroup/j-2EEZNYKUA1NTV/ig-1791Y4E1L8YI0.

     *
AppStream 2.0 fleet - The resource type is fleet and the unique
     * identifier is the fleet name. Example: fleet/sample-fleet.

     *

DynamoDB table - The resource type is table and the
     * unique identifier is the resource ID. Example: table/my-table.

     *

DynamoDB global secondary index - The resource type is
     * index and the unique identifier is the resource ID. Example:
     * table/my-table/index/my-table-index.

Aurora DB
     * cluster - The resource type is cluster and the unique identifier is
     * the cluster name. Example: cluster:my-db-cluster.

     *
Amazon SageMaker endpoint variants - The resource type is
     * variant and the unique identifier is the resource ID. Example:
     * endpoint/my-end-point/variant/KMeansClustering.

     *
Custom resources are not supported with a resource type. This parameter must
     * specify the OutputValue from the CloudFormation template stack used
     * to access the resources. The unique identifier is defined by the service
     * provider.

     */
    inline ScheduledAction& WithResourceId(Aws::String&& value) { SetResourceId(std::move(value)); return *this;}

    /**
     *
The identifier of the resource associated with the scaling policy. This
     * string consists of the resource type and unique identifier.

ECS
     * service - The resource type is service and the unique identifier is
     * the cluster name and service name. Example:
     * service/default/sample-webapp.

Spot fleet request
     * - The resource type is spot-fleet-request and the unique identifier
     * is the Spot fleet request ID. Example:
     * spot-fleet-request/sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE.

     *

EMR cluster - The resource type is instancegroup and
     * the unique identifier is the cluster ID and instance group ID. Example:
     * instancegroup/j-2EEZNYKUA1NTV/ig-1791Y4E1L8YI0.

     *
AppStream 2.0 fleet - The resource type is fleet and the unique
     * identifier is the fleet name. Example: fleet/sample-fleet.

     *

DynamoDB table - The resource type is table and the
     * unique identifier is the resource ID. Example: table/my-table.

     *

DynamoDB global secondary index - The resource type is
     * index and the unique identifier is the resource ID. Example:
     * table/my-table/index/my-table-index.

Aurora DB
     * cluster - The resource type is cluster and the unique identifier is
     * the cluster name. Example: cluster:my-db-cluster.

     *
Amazon SageMaker endpoint variants - The resource type is
     * variant and the unique identifier is the resource ID. Example:
     * endpoint/my-end-point/variant/KMeansClustering.

     *
Custom resources are not supported with a resource type. This parameter must
     * specify the OutputValue from the CloudFormation template stack used
     * to access the resources. The unique identifier is defined by the service
     * provider.

     */
    inline ScheduledAction& WithResourceId(const char* value) { SetResourceId(value); return *this;}

    /**
     *
The scalable dimension. This string consists of the service namespace,
     * resource type, and scaling property.

     * ecs:service:DesiredCount - The desired task count of an ECS
     * service.

 ec2:spot-fleet-request:TargetCapacity -
     * The target capacity of a Spot fleet request.

     * elasticmapreduce:instancegroup:InstanceCount - The instance count
     * of an EMR Instance Group.

     * appstream:fleet:DesiredCapacity - The desired capacity of an
     * AppStream 2.0 fleet.

     * dynamodb:table:ReadCapacityUnits - The provisioned read capacity
     * for a DynamoDB table.

     * dynamodb:table:WriteCapacityUnits - The provisioned write capacity
     * for a DynamoDB table.

     * dynamodb:index:ReadCapacityUnits - The provisioned read capacity
     * for a DynamoDB global secondary index.

     * dynamodb:index:WriteCapacityUnits - The provisioned write capacity
     * for a DynamoDB global secondary index.

     * rds:cluster:ReadReplicaCount - The count of Aurora Replicas in an
     * Aurora DB cluster. Available for Aurora MySQL-compatible edition.

     *
 sagemaker:variant:DesiredInstanceCount - The number of EC2
     * instances for an Amazon SageMaker model endpoint variant.

     * custom-resource:ResourceType:Property - The scalable dimension for
     * a custom resource provided by your own application or service.

     */
    inline const ScalableDimension& GetScalableDimension() const{ return m_scalableDimension; }

    /**
     *
The scalable dimension. This string consists of the service namespace,
     * resource type, and scaling property.

     * ecs:service:DesiredCount - The desired task count of an ECS
     * service.

 ec2:spot-fleet-request:TargetCapacity -
     * The target capacity of a Spot fleet request.

     * elasticmapreduce:instancegroup:InstanceCount - The instance count
     * of an EMR Instance Group.

     * appstream:fleet:DesiredCapacity - The desired capacity of an
     * AppStream 2.0 fleet.

     * dynamodb:table:ReadCapacityUnits - The provisioned read capacity
     * for a DynamoDB table.

     * dynamodb:table:WriteCapacityUnits - The provisioned write capacity
     * for a DynamoDB table.

     * dynamodb:index:ReadCapacityUnits - The provisioned read capacity
     * for a DynamoDB global secondary index.

     * dynamodb:index:WriteCapacityUnits - The provisioned write capacity
     * for a DynamoDB global secondary index.

     * rds:cluster:ReadReplicaCount - The count of Aurora Replicas in an
     * Aurora DB cluster. Available for Aurora MySQL-compatible edition.

     *
 sagemaker:variant:DesiredInstanceCount - The number of EC2
     * instances for an Amazon SageMaker model endpoint variant.

     * custom-resource:ResourceType:Property - The scalable dimension for
     * a custom resource provided by your own application or service.

     */
    inline void SetScalableDimension(const ScalableDimension& value) { m_scalableDimensionHasBeenSet = true; m_scalableDimension = value; }

    /**
     *
The scalable dimension. This string consists of the service namespace,
     * resource type, and scaling property.

     * ecs:service:DesiredCount - The desired task count of an ECS
     * service.

 ec2:spot-fleet-request:TargetCapacity -
     * The target capacity of a Spot fleet request.

     * elasticmapreduce:instancegroup:InstanceCount - The instance count
     * of an EMR Instance Group.

     * appstream:fleet:DesiredCapacity - The desired capacity of an
     * AppStream 2.0 fleet.

     * dynamodb:table:ReadCapacityUnits - The provisioned read capacity
     * for a DynamoDB table.

     * dynamodb:table:WriteCapacityUnits - The provisioned write capacity
     * for a DynamoDB table.

     * dynamodb:index:ReadCapacityUnits - The provisioned read capacity
     * for a DynamoDB global secondary index.

     * dynamodb:index:WriteCapacityUnits - The provisioned write capacity
     * for a DynamoDB global secondary index.

     * rds:cluster:ReadReplicaCount - The count of Aurora Replicas in an
     * Aurora DB cluster. Available for Aurora MySQL-compatible edition.

     *
 sagemaker:variant:DesiredInstanceCount - The number of EC2
     * instances for an Amazon SageMaker model endpoint variant.

     * custom-resource:ResourceType:Property - The scalable dimension for
     * a custom resource provided by your own application or service.

     */
    inline void SetScalableDimension(ScalableDimension&& value) { m_scalableDimensionHasBeenSet = true; m_scalableDimension = std::move(value); }

    /**
     *
The scalable dimension. This string consists of the service namespace,
     * resource type, and scaling property.

     * ecs:service:DesiredCount - The desired task count of an ECS
     * service.

 ec2:spot-fleet-request:TargetCapacity -
     * The target capacity of a Spot fleet request.

     * elasticmapreduce:instancegroup:InstanceCount - The instance count
     * of an EMR Instance Group.

     * appstream:fleet:DesiredCapacity - The desired capacity of an
     * AppStream 2.0 fleet.

     * dynamodb:table:ReadCapacityUnits - The provisioned read capacity
     * for a DynamoDB table.

     * dynamodb:table:WriteCapacityUnits - The provisioned write capacity
     * for a DynamoDB table.

     * dynamodb:index:ReadCapacityUnits - The provisioned read capacity
     * for a DynamoDB global secondary index.

     * dynamodb:index:WriteCapacityUnits - The provisioned write capacity
     * for a DynamoDB global secondary index.

     * rds:cluster:ReadReplicaCount - The count of Aurora Replicas in an
     * Aurora DB cluster. Available for Aurora MySQL-compatible edition.

     *
 sagemaker:variant:DesiredInstanceCount - The number of EC2
     * instances for an Amazon SageMaker model endpoint variant.

     * custom-resource:ResourceType:Property - The scalable dimension for
     * a custom resource provided by your own application or service.

     */
    inline ScheduledAction& WithScalableDimension(const ScalableDimension& value) { SetScalableDimension(value); return *this;}

    /**
     *
The scalable dimension. This string consists of the service namespace,
     * resource type, and scaling property.

     * ecs:service:DesiredCount - The desired task count of an ECS
     * service.

 ec2:spot-fleet-request:TargetCapacity -
     * The target capacity of a Spot fleet request.

     * elasticmapreduce:instancegroup:InstanceCount - The instance count
     * of an EMR Instance Group.

     * appstream:fleet:DesiredCapacity - The desired capacity of an
     * AppStream 2.0 fleet.

     * dynamodb:table:ReadCapacityUnits - The provisioned read capacity
     * for a DynamoDB table.

     * dynamodb:table:WriteCapacityUnits - The provisioned write capacity
     * for a DynamoDB table.

     * dynamodb:index:ReadCapacityUnits - The provisioned read capacity
     * for a DynamoDB global secondary index.

     * dynamodb:index:WriteCapacityUnits - The provisioned write capacity
     * for a DynamoDB global secondary index.

     * rds:cluster:ReadReplicaCount - The count of Aurora Replicas in an
     * Aurora DB cluster. Available for Aurora MySQL-compatible edition.

     *
 sagemaker:variant:DesiredInstanceCount - The number of EC2
     * instances for an Amazon SageMaker model endpoint variant.

     * custom-resource:ResourceType:Property - The scalable dimension for
     * a custom resource provided by your own application or service.

     */
    inline ScheduledAction& WithScalableDimension(ScalableDimension&& value) { SetScalableDimension(std::move(value)); return *this;}

    /**
     *
The date and time that the action is scheduled to begin.

     */
    inline const Aws::Utils::DateTime& GetStartTime() const{ return m_startTime; }

    /**
     *
The date and time that the action is scheduled to begin.

     */
    inline void SetStartTime(const Aws::Utils::DateTime& value) { m_startTimeHasBeenSet = true; m_startTime = value; }

    /**
     *
The date and time that the action is scheduled to begin.

     */
    inline void SetStartTime(Aws::Utils::DateTime&& value) { m_startTimeHasBeenSet = true; m_startTime = std::move(value); }

    /**
     *
The date and time that the action is scheduled to begin.

     */
    inline ScheduledAction& WithStartTime(const Aws::Utils::DateTime& value) { SetStartTime(value); return *this;}

    /**
     *
The date and time that the action is scheduled to begin.

     */
    inline ScheduledAction& WithStartTime(Aws::Utils::DateTime&& value) { SetStartTime(std::move(value)); return *this;}

    /**
     *
The date and time that the action is scheduled to end.

     */
    inline const Aws::Utils::DateTime& GetEndTime() const{ return m_endTime; }

    /**
     *
The date and time that the action is scheduled to end.

     */
    inline void SetEndTime(const Aws::Utils::DateTime& value) { m_endTimeHasBeenSet = true; m_endTime = value; }

    /**
     *
The date and time that the action is scheduled to end.

     */
    inline void SetEndTime(Aws::Utils::DateTime&& value) { m_endTimeHasBeenSet = true; m_endTime = std::move(value); }

    /**
     *
The date and time that the action is scheduled to end.

     */
    inline ScheduledAction& WithEndTime(const Aws::Utils::DateTime& value) { SetEndTime(value); return *this;}

    /**
     *
The date and time that the action is scheduled to end.

     */
    inline ScheduledAction& WithEndTime(Aws::Utils::DateTime&& value) { SetEndTime(std::move(value)); return *this;}

    /**
     *
The new minimum and maximum capacity. You can set both values or just one.
     * During the scheduled time, if the current capacity is below the minimum
     * capacity, Application Auto Scaling scales out to the minimum capacity. If the
     * current capacity is above the maximum capacity, Application Auto Scaling scales
     * in to the maximum capacity.

     */
    inline const ScalableTargetAction& GetScalableTargetAction() const{ return m_scalableTargetAction; }

    /**
     *
The new minimum and maximum capacity. You can set both values or just one.
     * During the scheduled time, if the current capacity is below the minimum
     * capacity, Application Auto Scaling scales out to the minimum capacity. If the
     * current capacity is above the maximum capacity, Application Auto Scaling scales
     * in to the maximum capacity.

     */
    inline void SetScalableTargetAction(const ScalableTargetAction& value) { m_scalableTargetActionHasBeenSet = true; m_scalableTargetAction = value; }

    /**
     *
The new minimum and maximum capacity. You can set both values or just one.
     * During the scheduled time, if the current capacity is below the minimum
     * capacity, Application Auto Scaling scales out to the minimum capacity. If the
     * current capacity is above the maximum capacity, Application Auto Scaling scales
     * in to the maximum capacity.

     */
    inline void SetScalableTargetAction(ScalableTargetAction&& value) { m_scalableTargetActionHasBeenSet = true; m_scalableTargetAction = std::move(value); }

    /**
     *
The new minimum and maximum capacity. You can set both values or just one.
     * During the scheduled time, if the current capacity is below the minimum
     * capacity, Application Auto Scaling scales out to the minimum capacity. If the
     * current capacity is above the maximum capacity, Application Auto Scaling scales
     * in to the maximum capacity.

     */
    inline ScheduledAction& WithScalableTargetAction(const ScalableTargetAction& value) { SetScalableTargetAction(value); return *this;}

    /**
     *
The new minimum and maximum capacity. You can set both values or just one.
     * During the scheduled time, if the current capacity is below the minimum
     * capacity, Application Auto Scaling scales out to the minimum capacity. If the
     * current capacity is above the maximum capacity, Application Auto Scaling scales
     * in to the maximum capacity.

     */
    inline ScheduledAction& WithScalableTargetAction(ScalableTargetAction&& value) { SetScalableTargetAction(std::move(value)); return *this;}

    /**
     *
The date and time that the scheduled action was created.

     */
    inline const Aws::Utils::DateTime& GetCreationTime() const{ return m_creationTime; }

    /**
     *
The date and time that the scheduled action was created.

     */
    inline void SetCreationTime(const Aws::Utils::DateTime& value) { m_creationTimeHasBeenSet = true; m_creationTime = value; }

    /**
     *
The date and time that the scheduled action was created.

     */
    inline void SetCreationTime(Aws::Utils::DateTime&& value) { m_creationTimeHasBeenSet = true; m_creationTime = std::move(value); }

    /**
     *
The date and time that the scheduled action was created.

     */
    inline ScheduledAction& WithCreationTime(const Aws::Utils::DateTime& value) { SetCreationTime(value); return *this;}

    /**
     *
The date and time that the scheduled action was created.

     */
    inline ScheduledAction& WithCreationTime(Aws::Utils::DateTime&& value) { SetCreationTime(std::move(value)); return *this;}

  private:

    Aws::String m_scheduledActionName;
    bool m_scheduledActionNameHasBeenSet;

    Aws::String m_scheduledActionARN;
    bool m_scheduledActionARNHasBeenSet;

    ServiceNamespace m_serviceNamespace;
    bool m_serviceNamespaceHasBeenSet;

    Aws::String m_schedule;
    bool m_scheduleHasBeenSet;

    Aws::String m_resourceId;
    bool m_resourceIdHasBeenSet;

    ScalableDimension m_scalableDimension;
    bool m_scalableDimensionHasBeenSet;

    Aws::Utils::DateTime m_startTime;
    bool m_startTimeHasBeenSet;

    Aws::Utils::DateTime m_endTime;
    bool m_endTimeHasBeenSet;

    ScalableTargetAction m_scalableTargetAction;
    bool m_scalableTargetActionHasBeenSet;

    Aws::Utils::DateTime m_creationTime;
    bool m_creationTimeHasBeenSet;
  };

} // namespace Model
} // namespace ApplicationAutoScaling
} // namespace Aws


text:
module Main where

import CmdArgs
import Parser
import System.Environment
-- import Control.Exception
-- import System.IO.Error
import System.Directory
import qualified Data.Map as Map
import Types
import Fcm
import Debug.Trace (trace)
import Data.Text as T
import Data.Maybe

main :: IO ()
main = do
  args <- getArgs
  let cmdOptions = parseToMapCmdOptions args
  print cmdOptions
  let fileName = getMaybeValue $ (Map.lookup "-i" cmdOptions)
  fileExists <- doesFileExist fileName
  if fileExists
    then do
      -- ohuitelno http://stackoverflow.com/a/11240248/2652540
      fileContent <- readFile fileName
      let fileStr = T.unpack $ T.strip $ T.pack fileContent
      let objs = parseFile cmdOptions fileStr
      let clusteringArgs = parseCmdArgsToClusteringArgs cmdOptions
      let matrixAccessoriesResult = clustering clusteringArgs  objs
      putStrLn "Res:"
      outputResult matrixAccessoriesResult cmdOptions
  else putStrLn "Файл не существует!"
  putStr "End vitek laba ahahaha"

parseCmdArgsToClusteringArgs::Map.Map String String -> ClusterArg
parseCmdArgsToClusteringArgs opt = CA {getEpsilon = eps, getCountClusters = c, getMetrix = metrConst}
  where eps = read $ getMaybeValue $ (Map.lookup "-eps" opt) :: Double
        c = read $ getMaybeValue $ (Map.lookup "-c" opt) :: Int
        metrixName = getMaybeValue $ (Map.lookup "-m" opt)
        metrConst
          | metrixName == "euclid" = Euclid
          | otherwise = Hamming

outputResult::Matrix -> Map.Map String String -> IO()
outputResult m opt
  | (isJust fn)  = writeFile (fromJust fn) (show m)
  | otherwise = print m
  where fn = (Map.lookup "-o" opt)


text:
export const example: string
export const example__description: string
export const exampleDescription: string


text: console.log("app.js", "Hello World!");